Welcome to WebmasterWorld Guest from 54.144.108.92

Forum Moderators: phranque

Message Too Old, No Replies

When Reaching an Inactive Page

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

New User

5+ Year Member

joined:Sept 28, 2006
posts:13
votes: 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?

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

Junior Member

5+ Year Member

joined:Aug 1, 2006
posts:112
votes: 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

<?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.

    ssg

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

    New User

    5+ Year Member

    joined:Sept 28, 2006
    posts:13
    votes: 0


    Thanks for your reply.
    8:23 pm on Jan 23, 2007 (gmt 0)

    Full Member

    10+ Year Member

    joined:Nov 3, 2003
    posts:324
    votes: 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.
     

    Join The Conversation

    Moderators and Top Contributors

    Hot Threads This Week

    Featured Threads

    Free SEO Tools

    Hire Expert Members