Scripts » Custom 404 error page

So, you've seen the smart sites with these custom 404 error pages. They're smart because they know how hard it is to keep a visitor from wondering off from what you want them to see, your website. Go to www.oziz.co.uk/thispagedoesnotexist to see what you can acheive.
Customizing your 404 error page will be a helping-hand in directing the lost visitor back to the mainstream content, instead of the visitor thinking there's a problem with your site and moving on.
Before we start, I should warn you that this tutorial only works for self-hosting websites (ie. you pay for the hosting account and own the domain name)
Ok let's go :o)

1. Open up notepad (or any basic text-editor), and type this line: ErrorDocument 404 http://www.yourdomain.com/404.html

2: Save this file as .htaccess. nothing goes before this, it is the file-name, not an extension. Make sure you select 'All file types', otherwise it usually saves as .htaccess.txt.

3. Create the 404.html page, giving the visitor a 'sorry' and a link back. Try and make it blend in with the look of the rest of your site :o)

4. Upload both of these files to your server in the main root (where the homepage is).

5. CHMOD the .htaccess file to 644, if you don't know how to CHMOD then this isn't really life threatning.

6. Type in a total random page (that doesn't exist, duh) under your domain, and watch it magically come up with your customized version 404.


Go back home