Mobile app version of vmapp.org
Login or Join
Caterina187

: Custom message error with apache2 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

@Caterina187

Posted in: #Apache2

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

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Caterina187

1 Comments

Sorted by latest first Latest Oldest Best

 

@Chiappetta492

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

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme