<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/platform.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d29653863\x26blogName\x3dPro-SEO\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dSILVER\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttps://pro-seo.blogspot.com/search\x26blogLocale\x3den_US\x26v\x3d2\x26homepageUrl\x3dhttps://pro-seo.blogspot.com/\x26vt\x3d5776149128057648236', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>
« Pro-SEO Home || Add Social Bookmarking Buttons To Blogger Blog » || Google Checkout Banned By eBay » || Longest Time Ever Between PR Updates » || Google Adsense google_hints Code » || Adsense Bot Now Helps Google Bot Index Sites » || How To Pick The Best Web Host Or Server » || Google Release Google Checkout » || BlackHat SEO - Why you shouldn't do it. » || How To Prevent Image Hotlinking » || When Is The Next PR (page rank) Update? »

Custom 404 Error Message Page


Custom 404 error message
I was asked earlier by a friend how to create a custom 404 error page, So i figured i would write a small tutorial on it.

Why would i want a custom 404 error page?
The main reason for using a custom 404 error page is to add a little personality or humor to something that is, at the end of the day, a mistake on your part. Some people like to include a funny story about why the page is not there, Others prefer the heartfelt apology, But the main thing to include on this 404 error page is a link to your homepage, Which is something a regular 404 error page doesn't include.

First thing you need to do is instruct your server to use a specific page for your custom 404 error page instead of the usual boring page. We do this with an .htaccess file.
If you don't already have an .htaccess file in your root directory, Create one, Then put the following line into it.
ErrorDocument 404 http://www.domain.com/404-error-page.php

Change domain to your domain.
So now you know how to make your server display your custom 404 error message, What should we put on it? This is where your imagination comes in. It is a good idea to keep your error message lighthearted.. If you know PHP you could even make your 404 error message send you an email every time someone gets an error.
| Google Checkout Banned By eBay »
| Longest Time Ever Between PR Updates »
| Google Adsense google_hints Code »
| Adsense Bot Now Helps Google Bot Index Sites »
| How To Pick The Best Web Host Or Server »
| Google Release Google Checkout »
| BlackHat SEO - Why you shouldn't do it. »
| How To Prevent Image Hotlinking »
| When Is The Next PR (page rank) Update? »

Posted by Blogger [ Matt ] @ Friday, 28 July, 2006

I believe a 302 status would be correct mark because the server has been instructed to serve the custom page instead of sending a 404 status.

The 302 status sends the visitor to your custom page whenever they request a page that doesn't exist.

I have never really thought about checking the status sent by a custom 404 error page, I'll look into it and post here if i find anything.  



Posted by Blogger [ Matt ] @ Friday, 28 July, 2006

Good point Mark, I hadn't really though about that. My guess would be as long as you are not giving a 200 status (everything is ok) it should be fine.

This method of custom 404's has been used for a long time so i would be very surprised if it was able to get you penalized by search engines.

I will definately try to find a definitive answer on this though, I'lll post if i find it.  



Posted by Anonymous Anonymous @ Saturday, 29 July, 2006

Saw your post over at Matt Cutts' blog, and had to comment.
You need to change the entry in the .htaccess to:
ErrorDocument 404 /404-error-page.php
It seems that the relative link is important in the handling of the error in Apache.
We had a discussion here about it...  



Post a Comment