Custom error pages using .htaccess

October 3, 2008 · Print This Article

There is a huge list of things that you can do with .htaccess file like protecting folders with a password, redirecting your visitors, custom error messages, banning certain IP address or only allowing users with certain IP address, to stop directory listing, etc… In this article I am going to explain how to create your own custom error pages instead of using your host’s error pages or having no page.

Custom error pages
The 404 error message is an HTTP response indicates that the server couldn’t find what the client requested. You may want to redirect your visitors to error message that you created. This can be done by adding the line below into your .htacess file.

ErrorDocument 404 http://www.yourdomain.com/error.htm

You can also add extra lines for errors 401, 403 or 500 and refer them to different error pages that you created.


Your choice for site templates and wordpress themes

Comments

Got something to say?

You must be logged in to post a comment.