Forum Moderators: phranque

Message Too Old, No Replies

Yet another soft 404 post

         

cschults

7:17 pm on Aug 7, 2008 (gmt 0)

10+ Year Member



I've Googled. I've searched these forums. And I can't figure out what is going on.

I'm experiencing something very similar to rocknbil as discussed here:

[webmasterworld.com...]

I realized that our 404 page was returning a status code of 200 for most requests. I checked httpd.conf and found this:

ErrorDocument 404 /errors/notfound.html

Which was also present in the .htaccess located in the document root.

But as I said, 200 is being returned for *most* requests.

For example:

www.example.com/bad.html = 200
www.example.com/good/bad.html = 200
www.example.com/special1/bad.html = 404
www.example.com/good/special2/bad.html = 404

So what was so special about special1 and special2? These two directories have their own .htaccess files with no ErrorDocument directive.

When I commented out the RewriteEngine and RewriteRule directives in one, a 200 status code was being returned. Uncomment, 404.

So then I removed the ErrorDocument directive from my root .htaccess file with no change -- still 200.

What's going on?

BTW, we're running Apache/2.2.3 (CentOS).

Also, I've checked live headers, and I don't see an redirection going on.

Chris

jdMorgan

8:07 pm on Aug 7, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What 'source' are you looking at to determine that a 200-OK is being returned -- Are you looking at the server logs or the HTTP Headers report.

Note that in many server configurations, the "status" token is for 'original status' rather than 'final status' (See mod_log_config). In many cases, this will *show* a 200-OK on any URL-path that gets rewritten, even though the final response after the rewrite is a 404. For the life of me, I do not know why this was considered useful, but in fact, your server logs can show a 200-OK when in fact the actual server response header contained a 404-Not Found.

Beware of another 'gotcha' and that is the the URL-path given in an ErrorDocument must be a local URL-path and not a full URL. If you specify a full URL, then the result is a 302 redirect to the error document's URL, which then results in a 200-OK response.

Does any of this help? If not, we're going to have to look at your rewrites and get a lot more detailed.

Jim

cschults

8:32 pm on Aug 7, 2008 (gmt 0)

10+ Year Member



Jim,

As you suspected, something else was going on in one of my .htaccess files. Upon closer inspection, the root .htaccess file had a RewriteRule that I thought was specific to a directory, but realized that it was being applied to all requests (except those in the special directories). I commented out the offending rules and all looks good. Mystery solved!

Chris