Hi,

I have a question about custom 404 pages:

Lets say the user enters a non existing url, and the custom 404 page is made like this:

header("HTTP/1.0 404 Not Found");
header("Location: http://www.domain.com/custom404.php");

What does google do when reaching this code?

Does it create any duplicate content? since there is a url after the domain name??

Does it know not to index, or register any more when seeing the 404 header?

Hope some of you has the answer to this :-)

OR WHAT IS THE BEST WAY TO HANDLE 404 ERRORS WHEN IT COMES TO SEO???

Klemme

Google knows that when the header passes a 404, whatever URL was used to get to that page no longer exists. It will deindex that URL.

And the custom404.php, is not being evaluated as being a page that has duplicate content, so the entire site would be degraded in seo results?

As long the google bot sees the 404 header, it doesnt even follow the other header to the custom404.php, or?

I'm pretty sure that's how it works, yes.

cscgal, it's fine google prefer this, thanks.
But, I have a question when visitor's are trying to put any extension after url, which is not available with my web site, it should be redirect to my home page. is it fine ? or there showing 404 oops url not available. which one??

You *could* do 301 permanent redirects back to your homepage, but that isn't really their intended purpose. The intended purpose of 301 redirects is for renamed/moved pages. Not for pages that didn't exist in the first place. I wouldn't recommend redirecting back to the homepage, but you could either redirect to the specific page without the extension after, or do a 404 not found.

Google knows that when the header passes a 404, whatever URL was used to get to that page no longer exists. It will deindex that URL.

Thanks its useful.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.