1

I am currently running a web server using Apache 2.4.10.
I would like to know how I can make custom error page, using the proper way.

Please, note that several solutions are available online, but seem deprecated.

I noticed the configuration file /etc/apache2/conf.d/localized-error-pages.conf. It informs me that the default messages were available in the directory /usr/share/apache2/error/. It also tells me that in order to change the layout, I should add the line :

Alias /error/include/ "/your/include/path"

But it doesn't explain where/how.

Moreover, I tried to change these files, reload apache2, and get an error page, but the error messages didn't change

1 Answer 1

1

The proper way to make custom error messages is by using .htaccess.

First off, make an .htaccess file in your site directory. The syntax is easy:

ErrorDocument code path

So for example, if you were to build a custom error page for the 404 message, you could use this line of code given the path for your 404 document is 404.html.

ErrorDocument 404 404.html

Same way for errors like 500:

ErrorDocument 500 500.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.