Aug 21, 2011
tom

Mod_rewrite (CakePHP routing functionality) forbidden after Snow Leopard upgrade

Question

I am using the standard Apple-provided installations of PHP 5.3 and Apache 2 to do web development on a Mac Pro that I just upgraded to Mac OS X 10.6 (Snow Leopard). The upgrade went well enough, if I ignore the fact that it destroyed my ability to get work done. ;)

After the update, the CakePHP application I was developing started giving me 403 Forbidden errors when accessed. Based on the errors in the log file, I’ve determined that Apache is choking on the mod_rewrite rules in Cake’s .htaccess file. Here’s the file, in its entirety:

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule    ^$ app/webroot/    [L]
   RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>

It’s not that the rules themselves are wrong, but that Apache is forbidding the use of mod_rewrite altogether. All other pages on the machine work fine, and the 403 errors go away if I comment out the .htaccess file (but nothing works, of course).

In my httpd.conf file, I’ve tried changing this:

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

To this:

<Directory />
    Options FollowSymLinks
    AllowOverride All
    Order deny,allow
    Allow from all
</Directory>

…which has no effect.

I don’t know much about Apache configuration files, and I’m quite stuck on this. In fact, I know little enough that I’m not sure which information about my setup is needed to enable people to provide useful answers. I’m just using the vanilla OS X setup, nothing fancy.

Googling has yielded no fruits for me this time, so I’m turning to you. Any ideas?

Answer

How about the ownership/permissions of the files your pointing to? I’m more inclined to think Apache can’t get to them rather than it being Apache at this point.

Edit with solution: Put Options +FollowSymLinks above RewriteEngine On

Related posts:

  1. Apache mod_rewrite not working properly on Mac OS X 10.6 (Snow Leopard)
  2. Why does mod_rewrite [F] forbidden return a 404 instead of 403?
  3. problems with Apache on Snow Leopard
  4. 403 Error after upgrading from Snow Leopard to Lion
  5. Mapping drives on MacOSX (Leopard/Snow Leopard) permanently inside LAN

Leave a comment