How to create a 404 page?

404 page can be your invisible cash cow!. As I mentioned in the previous post on how to use popup ads wisely for your free hosting services, you can put some ads on a 404 page.


Now you know why nobody buys ads from Yahoo!

404 page refers to the “Page not found”. When a page is requested, your web server will serve the page to the web browser if it exists. If it is not existing, the web server will issue a 404 error. By default, most web servers (e.g., Apache) will give a plain text page indicating the page is not found.

The page not found error can be caused by different reasons. For example:

  • typo in the URL;
  • page was deleted;
  • broken link;
  • change of rewrite rules;
  • you want to hide some pages to certain visitors;

For free hosting providers, you usually get 5-15% of such traffic. More importantly, visitors usually will click one of the links in this page to navigate to the other pages. That is the reason why I always urge all free hosting providers create a meaningful 404 page and monetize from it. Meaningful means clear navigation to proper pages (e.g., homepage, signup page, ..).

To create a 404 page is very simple. On most systems (Linux+Apache), you need:

  1. create a html/php page. You can use your existing template so that this page has consistent appearance with all other pages. You can use html and any programming language (e.g., PHP), just like a normal content page. Then name it as you want.
  2. in your website’s home directory (for cpanel, it is public_html directory), modify the .htaccess file. At the end of this file, add one line (replace whatever.php with the file name you specified in step 1):
    ErrorDocument 404 /whatever.php
  3. update the .htaccess file. Test it with a non-existing page (e.g., http://YOURDOMAIN/nonexisit.pppp )

When you prepare you 404 page in step 1, it is important to put clear navigation (links) so that visitors can be redirected to the most suitable pages. You can also put some ads on this page. The conversion rate or CTR on a 404 page actually is similar (if not better) than other content pages.

Also, when you name the file, try to avoid 404 in file name because search engines do not like 404.php or 404.html. You may use “navigation.php” or “notfound.php”.

Anyway, put a 404 page today to: 1) provide better navigation for the lost visitors; 2). monetize such traffic.


  1. I found this as a great suggestion on how to make a better “navigation” page.

    But, d’you think search engine really hate 404 page?

Leave a Reply