Allow ModRewrite in Mac OS X

ModRewrite is described on the Apache page as the “Swiss Army Knife of URL manipulation”. So you can imagine my upset when it wasn’t working on my Mac. Luckily, all I had to do was a small config change to enable it.

To fix this I had to edit:

/private/etc/apache2/httpd.conf

and change it to allow override by .htaccess files.

Find the directory at around line number 194 - /Library/WebServer/Documents . Then change to:

AllowOverride All

You’ll need to restart apache which you can do via System Preferences -> Sharing -> Web Sharing then uncheck and recheck it. I prefer the old fashioned way:

sudo apachectl graceful

Note that if you are trying to get this to work on your apache local to your user area then you will also need to change that config.

P.s. There is also a quote from Brian Moore on the Apache page which describes ModRewrite as “voodoo”, so beware!

View Comments