0
(0)

Last Updated on April 11, 2021 by Amit

With ErrorDocument directive it is also possible to show a custom error text instead of redirecting the request to error page. You can use your own error text message that will be displayed to broken requests on the server.
Here is an example :

ErrorDocument 404 "Sorry the page could not be found"

This will display the error text on the same window if something that doesn’t exist on server is requested.
You can also use HTML tags to mark up the text

ErrorDocument 404 "<h1>Sorry the page could not be found</h1>"

If you want to do the same for 403 requests, use the following :

ErrorDocument 403 "Sorry the page could not be found"

This method is helpful especially when you don’t want to redirect your broken or forbidden requests to an external or error pages.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.