.htaccess in home directory brought down all my sites

Submitted by Darren Oh on Tue, 07/19/2016 - 16:13

This afternoon, most of the sites running on my computer started responding with “500 Internal Server Error”. The Apache error log showed the following error:

[Tue Jul 19 16:17:01.418642 2016] [core:alert] [pid 79692] [client] /Users/darren/.htaccess: <IfModule not allowed here

I couldn’t find anything wrong with the .htaccess files or any changes to the server configuration. Finally, I noticed that the .htaccess file was not in the site directory. I had accidentally copied a site to my home directory earlier in the day, and missed the hidden .htaccess file when I was cleaning up. Removing it brought the sites back up.

Before this, I had assumed that Apache wouldn’t check .htaccess files outside a site’s document root directory.