Forum Moderators: phranque

Message Too Old, No Replies

Custom 404 pages

Confusing advice from Webmaster Tools on 404 errors

         

jasimon9

8:50 pm on Apr 27, 2016 (gmt 0)

10+ Year Member



One of our consultants has advised us that it appears that Google Webmaster Tools is advising that a custom 404 page should not return 200, but should continue to return 404. We have a custom 404 page. Since it is a page on our site, we current have it set to return 200.

Is this correct that custom 404 pages should return 404?

Andy Langton

9:23 pm on Apr 27, 2016 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Is this correct that custom 404 pages should return 404?


Absolutely. Your custom 404 page can display whichever content it likes, but it needs to deliver a 404 HTTP status code. It makes no difference if it is a custom page or not.

If you return 200 for a custom error, Google will index those pages. It's very unlikely that you want this to occur.

Since it is a page on our site, we current have it set to return 200.


If someone directly requests the URL of your custom 404 page, then there is a case for returning 200 (and one for returning 403). If I ask for /broken-url, I should see your custom content, but with a 404 status code.

lucy24

11:03 pm on Apr 27, 2016 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



a custom 404 page should not return 200

Unless you have made a mistake, the 404 page should never return anything, because no search engine will learn its "real" URL and hence will never request it by name.

Crystal ball says your developers have made the common mistake of saying
ErrorDocument 404 http://www.example.com/missing.html
instead of simply
ErrorDocument 404 /missing.html
The version with full protocol-plus-domain changes the 404 response into a 302 redirect, which in turn leads to a 200 on the new request. (There are undoubtedly ways to make the same mistake in IIS and other servers too, but this is the Apache subforum.)

not2easy

11:07 pm on Apr 27, 2016 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



If you are on Apache server, there should be a line in your .htaccess file like:
ErrorDocument 404 /custom404page.html
(or whatever the name of your custom 404 page is.)
so that it is returned by default for missing pages (not found) along with the 404 header. When a visitor gets a 404 error, they should see the URL of the page they asked for, not the URL of the custom 404 page. I would do a random nonsense edit of a real page URL and check the headers to see what is happening. An example would be to go to http://example.com/realpage.html and replace the realpage.html URL with something you know is not there such as http://example.com/udkpxozimh.html while checking the headers.

If the site is on a CMS like joomla or wordpress, there may be different answers.

If you are on a Windows IIS server ignore all that, someone else can help out for IIS.

jasimon9

11:20 pm on Apr 27, 2016 (gmt 0)

10+ Year Member



This is very strange now.

Our config is set up properly, and in fact the custom 404 page is now returning 404 as it should. This originally came up when a consultant pointed out that Webmaster Tools crawl errors page did not like the 200 return from our custom 404 page. That led is down a twisted path. For now, the problem seems to have gone away.

In our config the line looks like this (and has for about 11 years):

ErrorDocument 404 /error404.php

[edited by: Ocean10000 at 3:22 am (utc) on Apr 28, 2016]
[edit reason] removed link per tos [/edit]