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:

a2enmod rewrite

In my /etc/apache2/apache2.conf file I've added this:

<Directory "/var/www">
  AllowOverride ALL
  Options FollowSymLinks

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!


3 Answers 3


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

for my directory in httpd.conf. But once I did and restarted apache with

apachetcl -k restart

the htaccess worked fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.