How To Create A Custom 404 Error Page


Hi,

In this article I’m going to show you how to create a custom 404 page for your website.

A custom 404 page is displayed when someone has mistyped or follows a dead link on your website, without a custom page your visitor will just get a generic server error like the one below.

The reason for creating a custom 404 page is to ensure that your website visitors find what they were looking for and do not leave your site.

It’s really easy to setup and will take less than 5 minutes.

The first thing you need to do is create a .htaccess file if you don’t already have one,
if you do have one then edit existing file and add the text ErrorDocument 404 /page-not-found.html on a new line.

1) Open your default html editor

2) On the file menu select new html file

3) In the code of the document type
ErrorDocument 404 /page-not-found.html

4) Save the file as .htaccess in the top of your website

Note that the file does NOT have a file name just save as .htaccess
ensure that the file is NOT saved with an extra extension such as .htaccess.html

Important: Don’t overwrite your existing .htaccess file if you have one, if you already have this file just add the this line

ErrorDocument 404 /page-not-found.html

at the bottom of the code and save.

Now to create the custom 404 error page.

1) Within your default html editor create a new page or open your template page.

2) In the main text area type something like “Sorry, the page your looking for cannot be found”

3) In the main text area underneath your “Sorry…” heading include some navigation links to your websites main content, sitemap or site search feature.

4) Save the file in the top of your website as page-not-found.html

5) Upload the html page and .htaccess files to your website.

6) Test to make sure it’s working type your domain name into your browsers address bar follow by a page or location that does not exist.

http://www.yourdomain.com/AnythingYouWantHere

If all is working properly you should see the new custom 404 error page you just created.

Extra tip: Include Google analytics on the custom page and check your stats every month to see what pages or dead links are leading people to the 404 page and then you can fix them.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s