Creating custom error pages

Now if you are surfing the web then you might have came across “page not found” and other web server errors.

It is frustrating when you are dumped on that page with no option other then Refresh and check your internet connection etc :D and I guess you just move on to some other site in order to find what you were looking for. Same thing happens when visitors are visiting our own websites.

If Traffic is important [which it is] then you should try and keep those visitors on your site. If they do get a 404 page due to some bad link or an old/outdated link then you can get them back on the track by showing custom error pages.

First of all create a .htaccess file on the server.

If it is already there then no need to create one but just edit it.

Put the below lines in it:

ErrorDocument 401 /401.html
ErrorDocument 403 /403.html
ErrorDocument 404 /404.html
ErrorDocument 500 /500.html

Save the .htaccess

Now open up your favorite HTML editor and create the above 4 pages. 401.html, 403.html, 404.html and 500.html

Make it in such a way that it does shows the error number [useful if someday you yourself get one of this page].

Add the Homepage or sitemap link and some other info that can tell your visitors that an error has occurred but they can keep navigating from the mentioned links.

Upload this files to the root of your site where you just created that .htaccess file.

Once this is done you will stop losing those people who were just going away due to the normal error pages. They will now see custom 404 and other error pages with custom information that you provided to them. They will now also be able to just click your homepage or sitemap link and continue their surfing.