Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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
add comment

1 Answer

up vote 1 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
</Directory>

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

share|improve this answer
    
Yeah, that's it. Thanks. –  rancor1223 Jul 9 '13 at 20:58
add comment

Your Answer

 
discard

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.