Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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: 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 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!


share|improve this question
up vote 2 down vote accepted

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 ?

share|improve this answer

Check your error file /var/log/apache2/error.log when you try to call "test" check if matches the correct directory.

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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