Ubuntu – Apache .htaccess not working

apache-2.2configurationhttpd.confPHPUbuntu

I have access to an Ubuntu Machine with apache installed, which I connect to Using PuTTy.

For some reason my .htaccess file is not working, this is all it contains:

ErrorDocument 404 /handler.php

Instead of going to the handler.php page it prints out the general Not Found apache page.

I've searched Google and all I can find is information saying make sure in your apache config AccessFileName is set to .htaccess and AllowOverride is set to All.

I made the'e changes to my config file (/etc/apache2/apache2.conf) and it now contains this:

AccessFileName .htaccess

<Directory />
    AllowOverride All
    #AllowOverride None
</Directory>

I restarted apache (sudo /etc/init.d/apache2 restart), but I am still getting the exact same problem.

Sorry, I'm rather unfamiliar with Linux and Apache Config.

Best Answer

grep -R AllowOverride /etc/apache2 : try to see if any active configuration file (in conf.d or sites-enabled) is not putting some restrictions on a parent directory of your webroot (for / it's ok, but if someone can put a restriction on /var/www/mysite). You can check the .htaccess is read by setting deny from all inside (you should get access denied)