Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-03-2007, 03:28 AM
Junior Member
 
Join Date: Sep 2007
Posts: 2
Default Problems with htaccess or httpd.config

This is on OS X.

I'm able to get ZF working fine when I only have an IndexController, but calling anything else gives me a 404. The problem is, I'm not being redirected to the bootstrap index.php file. My browser is searching for an actual directory, so my rewrites aren't working.

I've tried every tip I've found, but nothing works. Here's my setup:

In httpd.conf, mod_rewrite is loaded:
Code:
LoadModule rewrite_module     libexec/httpd/mod_rewrite.so
Allow override is all:
Code:
    AllowOverride All
I have a virtual host pointing directly to my test app:

Code:
<VirtualHost zend.dev:80>
   DocumentRoot /Users/me/Sites/conventional/document_root
   ServerName zend.dev
</VirtualHost>
My .htaccess in document_root looks like:
Code:
RewriteEngine on
RewriteRule !\.(pdf|php|js|ico|txt|gif|jpg|png|css|rss|zip|tar\.gz)$ index.php
When I type http://zend.dev/ into my browser, I get my index controller's default action. Great.

But when I try my FooController, http://zend.dev/foo, I get 404 Not Found.

I can actually type the index page directly, and it works:

http://zend.dev/index.php/foo

... so it seems my .htaccess file just isn't kicking in. What am I missing? Thanks for any help.

One more note: I tried doing all this in my httpd.conf file as suggested in the wiki,
Code:
<VirtualHost zend.dev:80>
   DocumentRoot /Users/me/Sites/modular/document_root

   ServerName zend.dev
   RewriteEngine off
	
	<Location />
		RewriteEngine on
		RewriteCond %{REQUEST_FILENAME} !-f
		RewriteCond %{REQUEST_FILENAME} !-d
		RewriteRule !\.(pdf|php|js|ico|txt|gif|jpg|png|css|rss|zip|tar\.gz)$ /index.php
		
	</Location>
</VirtualHost>
... but I get 403 permission errors for any page I try to access.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 09-03-2007, 03:17 PM
Junior Member
 
Join Date: Sep 2007
Posts: 2
Default

Fixed the 404 issue.

I had 'AllowOverride All' inside here:
Code:
<Directory "/Library/WebServer/Documents">
... but my VirtualHost is pointing to my Sites directory, so it didn't apply there. Adding a <directory> specifically for that fixed it:
Code:
<Directory /Users/me/Sites/*>
Options FollowSymlinks
AllowOverride All
</Directory>
Got help from this wiki entry, btw: RewriteHtaccessIgnored - Httpd Wiki

Hm, also, it now looks like the 403 issues with putting all the mod_rewrite stuff inside httpd.conf are gone by adding this directory directive. (I moved my .htaccess file, and it still seems to be working correctly.)

Hope this helps any OS X user out there:

1. Set up your virtual host so you can get to your document root without any slashes (which will be interpreted as controllers, etc.).
2. Make sure to add a <Directory> for your Sites folder with AllowOverride All.

Last edited by purp : 09-03-2007 at 03:23 PM. Reason: Added info about 403 success
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 10:27 PM.