Webmasters Stack Exchange is a question and answer site for pro webmasters. 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 have my small website (made for study purposes) on localhost and I am trying to get .htaccess working (note that I am a complete beginner to .htaccess). So far, I have discovered that .htaccess is not even read by the server (I tried creating a custom 404 page - no change).

I've got my server setup on a Raspberry Pi and I am accessing it over a local network. But even after allowing mod_rewrite using sudo a2enmod rewrite (and rebooting apache2) it still doesn't work.

Any suggestions? Ask for any additional info. I will do my best to answer it.

share|improve this question
up vote 2 down vote accepted

If your .htaccess is not being read by the server, then that's the problem you need to fix first. Enabling .htaccess files is done using the AllowOverride directive, which tells Apache to look for that file in the specified folder for additional configuration info.

If you're using the default vhost (which will be somewhere like /etc/apache2/sites-available/default), then check that file for:

AllowOverride None

and change it to:

AllowOverride All

If it appears in that file multiple times, you only want to edit the one relating to your DOCUMENT_ROOT directory.

If the line isn't in there, check your main Apache config file instead.

If you've created a new vhost, you'll need to add a new <Directory> block:

<Directory "/path/to/your/docroot">
    AllowOverride All

Alternatively, anything you put in a .htaccess file could instead be put in the vhost itself.

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.