You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Lanny Marcus <ma...@computer2.com> on 2007/07/23 12:45:26 UTC

[users@httpd] Custom 404 Error Page returning 200 status code - Apache/1.3.27 (Unix)

Hello: The last line in the .htaccess file is 
ErrorDocument 404 http://www.mydomainname.com/missing.html

If someone tries to view a page that does not exist, the Custom 404
Error Page is displayed, properly. I am trying to get Google to verify
that I am the owner of this site (so I can use their Webmaster tools),
and I have placed a page with a name they specified, in the site. Their
verification fails, because, 'We've detected that your 404 file (file
not found) error page returns a status of 200 (Success) in the header.
They need a status of 404 in the header of 404 pages. Note: Google does
a HEAD request (not a GET request). Also, I have noticed in the
Webalizer statistics, there are no 404 codes listed in the response
codes. I understand this is typical Drupal behavior, but this server
does not have Drupal installed. What do I need to do, to get this to
work properly?   Apache/1.3.27 (Unix)        TIA, Lanny


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: Custom 404 Error Page returning 200 status code - Apache/1.3.27 (Unix)

Posted by "\"Crash\" Dummy" <gm...@thedatalist.com>.
If you want to send the request to a different domain while preserving the error
code returned to the requester, you can put a redirect meta tag in the local
error page. In your eaxmple, "/error_pages/404.html" would look like this:

<HTML><HEAD>
<META http-equiv="refresh" content="0; URL=http://www.remotedomain.com">
</HEAD><BODY>
<div style="visibility:hidden">
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxa
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxb
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxc
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxd
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxe
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxf
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxg
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxh
</div></BODY></HTML>

(The hidden filler text is to satisfy MSIE's requirement for at least 512 bytes)

The local server access log will look like this (nada.htm doesn't exist):
[23/Jul/2007:09:01:43 -0400] "GET /nada.htm HTTP/1.1" 404 743
-- 
Crash




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Custom 404 Error Page returning 200 status code - Apache/1.3.27 (Unix)

Posted by Vincent Bray <no...@gmail.com>.
On 23/07/07, Vincent Bray <no...@gmail.com> wrote:
> On 23/07/07, Lanny Marcus <ma...@computer2.com> wrote:
> > Hello: The last line in the .htaccess file is
> > ErrorDocument 404 http://www.mydomainname.com/missing.html

PS. 1.3.27 is somewhat out of date. Expired, one might say. How about
using a (major) version that was released this millenium?
-- 
noodl

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Custom 404 Error Page returning 200 status code - Apache/1.3.27 (Unix)

Posted by Vincent Bray <no...@gmail.com>.
On 23/07/07, Lanny Marcus <ma...@computer2.com> wrote:
> Hello: The last line in the .htaccess file is
> ErrorDocument 404 http://www.mydomainname.com/missing.html

The docs:
http://httpd.apache.org/docs/2.2/mod/core.html#errordocument

say:

=====
Note that when you specify an ErrorDocument that points to a remote
URL (ie. anything with a method such as http in front of it), Apache
will send a redirect to the client to tell it where to find the
document, even if the document ends up being on the same server. This
has several implications, the most important being that the client
will not receive the original error status code, but instead will
receive a redirect status code. This in turn can confuse web robots
and other clients which try to determine if a URL is valid using the
status code.
====

.. solution: don't do that.

Use a path to the error page in your url space, like:

ErrorDocument 404 /error_pages/404.html

If necessary you can use Alias to bring this directory in to your url space.

-- 
noodl

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org