Need help finding what is wrong with my .htaccess not being read – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.
But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about debian, apache-2.2, mod-rewrite, .htaccess, .
I’m trying to use mod_rewrite through the .htaccess files and I have a big problem, the .htaccess files don’t seems to be read. The machine is running Debian 5.0 and it’s using the stable apache2 package.
I’ve followed instructions from this page: http://www.debian-administration.org/articles/136. Enabled mod_rewrite like that:
In my /etc/apache2/apache2.conf file I’ve added this:
<Directory "/var/www"> AllowOverride ALL Options FollowSymLinks </Directory>
In the root directory, I’ve created a .htaccess file with this content:
RewriteEngine on RewriteRule ^test$ foo.html
I’ve tried lots of suggestion from answers to similar questions to no avail. The error message I get when visiting foo.com/test is a 404 Page Not Found. All files are readable by everyone. There’s no problem when accessing foo.html directly. I’ve also tried to put garbage in another .htaccess to see if apache would complains about it, nothing changed. Maybe I’m just too tired!
If you don’t get a 500 error when accessing a directory with a .htaccess file with garbage in it then Apache isn’t reading your .htaccess file.
Do you have a site defined in the /etc/apache2/sites-available/default file (or whatever file is being used for your virtual host) which overwrites the AllowOverride All definition for that directory ?
Check your error file /var/log/apache2/error.log when you try to call “test” check if matches the correct directory.
I had a problem with my apache server not reading the htaccess as well, and as it turned out for me, I hadn’t set:
<Directory "YOUR_DIRECTORY"> AllowOverride ALL </Directory>
for my directory in httpd.conf. But once I did and restarted apache with
apachetcl -k restart
the htaccess worked fine.