Why Isn't My .htaccess Working?

Hitting snags in setup can be a real pain. We just had a problem where .htaccess files seemed to be completely ignored by our Apache web server. More specifically, in our local development environment powered by MAMP.

After a lot of searching and debugging, it turned out that the new version of MAMP had a little rule defined in httpd.conf which did not allow .htaccess to do it's magical overriding. So we head into our configuration file:

vi /Applications/MAMP/conf/apache/httpd.conf

And look for the following line:

<Directory />
    Options Indexes FollowSymLinks
    AllowOverride None
</Directory>

The AllowOverride None line is the one causing our little problem. We have two options, switch this line to "All" to allow .htaccess files in any directory, or set up a directory-specific rule with the code below:

<Directory "/Users/matt/Sites">
    AllowOverride All
</Directory>

A simple fix but it can be a pain to nail down the answer.

Leave a Reply