Skip to Main Content

Creating Custom 404 Error Pages

Posted on 10.17.2005

Regardless of your skills as a webmaster it is undeniably important to direct users to alternate locations of a site if they are unable to access certain files instead of risking the chance that they might just navigate away. Essentially, creating custom error pages enables you to create customer error pages to display when a user enters a wrong or outdated URL, when there is an internal server error or when the user is not authorized to access a specific directory of your web space.

If you are working on an Apache server, (find out if you are running an Apache server here) the following tutorial will help you set up your own custom error pages. Also ask your hosting provider if you are able to modify server configurations on a directory level. Essentially, everything (meaning error page implementation) revolves around a file called the .htaccess file.

- First (if you do not have one) you must create the .htaccess file. To do so simply open up a text editor such as Notepad and insert one line of text in this file: ErrorDocument 404 /error-page.htm

Error page image 01

- Next, save the text file and rename it on the server to .htaccess (with nothing preceeding the dot)

- Then create an actual error page for surfers to see when they are unable to access the file they initially intended to see. It helps considerably to have a page that your users will be familair with such as one using the same design, layout, etc. You may want to include links to alternate locations within your site and possibly a search box to help them locate specific pages. Upload the error page to your server.

- Finally, visit a page you know does not exist. You should be able to see the error page you created.

Advanced Error Page Techniques:

- If you are receiving multiple requests for a missing page you can make your .htaccess file redirect any requests for missing pages to their new location. Add a line for each one in your .htaccess file that says 'Redirect /oldpage.htm /newpage.htm'. Use the full path name if the old or new files are in directories.

Error page image 02

WebsiteMagazineMiniLogo

Leave Your Comment

Login to Comment

Become a Member

Not already a part of our community?
Sign up to participate in the discussion. It's free and quick.

Sign Up

 

Leave a comment
    Load more comments
    New code
  •