2

I use apache 2.4.10, and I can't use personal error pages.

I changed /etc/apache2/conf-available/localized-error-pages.conf and added :

ErrorDocument 404 /404.html

and created the file /var/www/404.html with the short string 404test inside.

However, when I relaunch apache, I get

Not Found

The requested URL / was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

What's wrong?
Is there a way to get more detail on the error?

  • /var/www/ is your document root? Because that's where it'll look for the document – Martijn Aug 18 '15 at 10:21
1

Roll back your changes in /etc/apache2/conf-available/localized-error-pages.conf, then use .htaccess to create a custom 404 page with the following:

ErrorDocument 404 /404.html

If that fails then try adding the full path to the 404.html document.

| improve this answer | |
1

Do not use .htaccess it add extra useless disk access.

Edit your web site configuration in /etc/apache2/sites-enabled/{yoursite}.conf add this outside any tag

# Error documents
ErrorDocument 404 /404.htm

# allow errors pages to be visible from any virtual host
Alias /404.htm /var/www/errors/404.htm

Like that your error pages will be available for any of your virtual host, without adding extra code in virtual host and save harddrive useless access.

| improve this answer | |
-1

Using internet explorer? your 404 page should have a minimum 0f 512 bytes of text. So say a line or 10. just try it with longer text.

| improve this answer | |
  • I don't see how that could possibly be the problem. He is getting a very specific message from Apache that the 404 document was not found. – Stephen Ostermiller Jan 16 '16 at 15:21

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.