0

I have a .htaccess file in /var/www, the contents of which is:

ErrorDocument 404 /404.html

In apache2.conf AccessFileName is .htaccess, and AllowOverride does not exist. For some reason, visiting example.com/anything does not show 404.html.

1
  • "and AllowOverride does not exist" - does not exist anywhere in the server config? The default setting on Apache 2.2 is AllowOverride All, however, AllowOverride None is often defined in the main server config to disable .htaccess for the server. – MrWhite Aug 26 '20 at 22:13
1

You will need to configure a suitable AllowOverride setting in your configuration file to get ErrorDocument to work. The override you require is fileinfo e.g.

<Directory /var/www/>
    .
    .
    .
    AllowOverride fileinfo 
 </Directory>
7
  • I added: <Directory /var/www/> AllowOverride ALL </Directory> to apache2.conf (there was no directory thing already). And it made no difference. – JJJollyjim Mar 23 '11 at 8:13
  • @JJ56: Ok, that was an example because I don't know your configuration. You should put the AllowOverride directive within the Directory block that makes sense to your configuration. Don't forget to restart you Apache too. – user9517 Mar 23 '11 at 8:22
  • Where is the directory block? There is none in ports.conf, apache2.conf, or httpd.conf. I added the one to apache2.conf, but 404 still dosen't work. – JJJollyjim Mar 23 '11 at 8:27
  • @JJ56: Which OS/distro are you using ? – user9517 Mar 23 '11 at 8:29
  • ubuntu server edition 10.10 – JJJollyjim Mar 24 '11 at 1:47

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.