homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / WebmasterWorld / Webmaster General
Forum Library, Charter, Moderators: phranque

Webmaster General Forum

When Reaching an Inactive Page

 10:14 pm on Jan 19, 2007 (gmt 0)

How can I get a generic message when someone reaches a page on my site that no longer exists?

Some get a 404 error. Some do nothing.
Is it a server-related issue?


smells so good

 10:28 pm on Jan 19, 2007 (gmt 0)

Yes, it is a server issue. You can easily create your own custom 404 (or any other server error) page if you have a text editor and access to the .htaccess file on your server.

You'll need to make sure that the .htaccess file on your server contains this information.

ErrorDocument 404 /404.php

Then, create 404.php

header("HTTP/1.0 404 Not Found");
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Pragma: no-cache');
echo "Custom 404 Not Found";

There are a couple of things to be aware of.

  • Check the server headers on this page.
  • In the ErrorDocument statement of your .htaccess file, do not use the full path to your document. My 404.php script is located in the root directory, as indicated by the statement.
  • In the 404.php script, you can echo any custom message that you want.
  • Ensure that no whitespace or text is echoed in the script before the headers are sent.
  • Change the first header, and filename, to create any custom server error message.
  • Check the server headers on this page.


  • mkinstlinger

     8:20 pm on Jan 23, 2007 (gmt 0)

    Thanks for your reply.


     8:23 pm on Jan 23, 2007 (gmt 0)

    For SEO and user experience purposes considering doing a 301 to a page with relevant content. People are visitng that page - don't waste the traffic.

    Global Options:
     top home search open messages active posts  

    Home / Forums Index / WebmasterWorld / Webmaster General
    rss feed

    All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
    Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
    WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
    © Webmaster World 1996-2014 all rights reserved