Forum Moderators: phranque

Message Too Old, No Replies

ErrorDocument 404 gives 200 response code. Why?

This is suppoded to be 404 response code.

         

SunnyRoad

9:01 pm on Jan 13, 2005 (gmt 0)

10+ Year Member



I read everything and made this htaccess file on server Apache/1.3.31 (Unix) PHP/5.0.0 FrontPage/5.0.2.2635 mod_ssl/2.8.19
File:
ErrorDocument 404 [currentmysite.com...]
ErrorDocument 403 [currentmysite.com...] forbidden.htm
SetEnvIfNoCase Referer "^http://www.currentmysite.com/" locally_linked=1
SetEnvIfNoCase Referer "^http://www.currentmysite.com$" locally_linked=1
SetEnvIfNoCase Referer "^http://currentmysite.com/" locally_linked=1
SetEnvIfNoCase Referer "^http://currentmysite.com$" locally_linked=1
SetEnvIfNoCase Referer "^$" locally_linked=1
<FilesMatch "\.(gif¦png¦jpe?g)$">
Order Allow,Deny
Allow from env=locally_linked
</FilesMatch>
It works just like everyone said it it would. I get real nice pages for the errors.
However, the access log shows a 304 resonse code for the 403 and a 200 response code for the 404 eror. I expected 403 and 404 response codes. This really messes up the stats and search engines. Is this what everyone gets? I see you do not not help with code. Can I get some help here or can you direct me to a forum that can help me?

jdMorgan

11:10 pm on Jan 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



SunnyRoad,

Welcome to WebmasterWorld!

The reason for this behaviour is clearly documented in the Apache ErrorDocument description [httpd.apache.org]; You cannot use a canonical URL with ErrorDocument, or it will generate a 302-Found (redirect) response, which will then result in a 200-OK on the error page itself. Use a local URL-path instead.


ErrorDocument 404 /page_not_found.htm

Jim

SunnyRoad

2:39 am on Jan 14, 2005 (gmt 0)

10+ Year Member



Jim
Thank you. Fascinating reading. I was also told to use a header checker and it show I was actually getting a 302 redirect which corresponds exactly. Nice to go to school and be happy. I made the mods. Will find out how ir works for sure on Sunday. SunnyRoad