| Welcome to WebmasterWorld Guest from 18.104.22.168 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Pubcon Platinum Sponsor 2014|
|When Reaching an Inactive Page|
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|
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');
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.
Thanks for your reply.
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.
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved