bingshui.org

the Life of Zim

30th March
2011
written by dzimney

So there are a ton of possible reasons why your .htaccess files might not be working. If the AllowOverride is set to None in a parent directory, that could be causing problems. If AccessFileName is not set correctly in your apache2.conf, that could be the source of your misery. In my case, it was the rewrite module. It appeared as though my .htaccess files weren’t being read by the server because rewrites is basically all then do on my sandbox. So, what’d I do? Spent the past six hours fighting with all the things that were working only to find that there’s a rewrite module that has to be enabled. Who knew.

So, enabling the module is pretty simple, assuming you’ve got it installed. Pretty sure it’s a default module though, it should be at least, but then again it should also be enabled by default in my opinion. Anway, you just need to make a symbolic link to the rewrite.load file from the mods-available directory to the mods-enabled directory (all found in your apache2 directory, usually found at /etc/apache2).

QUICK ANSWER:
Open a terminal and run the following:

$ cd /etc/apache2/mods-enabled
$ ln -s /etc/apache2/mods-available/rewrite.load rewrite.load

NOTES:
There are couple of things to note here. First, we are assuming that Apache is installed at /etc/apache2 on your system. We are also assuming that you have the rewrite module file rewrite.load in your /etc/apach2/mods-available directory. Finally it is important to note that when running the second line in the terminal, the one creating the symbolic link, you have to enter the full path to the file in the first parameter. You can’t shorthand it or enter it as a relative path.

Also, you can do a quick check of your mods-enabled directory. If there’s a link to the rewrite.load file already in there, this solution obviously isn’t going to work for you, so good luck.

Hope this saves someone else six hours of their life.