Still not working.
Here is my .htaccess file:
Code:
ErrorDocument 404 /errors/404.php
The page /errors/404.php contains this at the top before the DTD declaration of the HTML:
Code:
<?php
header("HTTP/1.0 404 Not Found");
?>
as suggested in the article you referenced.
A few things I've noticed:
If I specify an error document in the CPanel, then 404 errors get sent to that document, as expected, but send 302 responses instead of 404 to the client. If I do not specify an error page in CPanel but use a .htaccess file instead then all 404 errors go to
https://cp.freehostia.com/404/ with a 302 response.
It seems as though Freehostia isn't honoring the .htaccess file directives.
When I directly request the /errors/404.php file (rather than enter an erroneous URL) then everything works the way I want it to. The server responds with a 404 header and the custom error page is displayed in the browser.
Packet capture, direct request to /errors/404.php:
Query:
Code:
No. Time Source Destination Protocol Info
9 0.129165 192.168.1.149 66.40.52.73 HTTP GET /errors/404.php HTTP/1.1
Hypertext Transfer Protocol
GET /errors/404.php HTTP/1.1\r\n
[Expert Info (Chat/Sequence): GET /errors/404.php HTTP/1.1\r\n]
Request Method: GET
Request URI: /errors/404.php
Request Version: HTTP/1.1
Host: www.boredomsoft.org\r\n
Response:
Code:
No. Time Source Destination Protocol Info
11 0.279743 66.40.52.73 192.168.1.149 HTTP HTTP/1.1 404 Not Found (text/html)
Hypertext Transfer Protocol
HTTP/1.1 404 Not Found\r\n
[Expert Info (Chat/Sequence): HTTP/1.1 404 Not Found\r\n]
Request Version: HTTP/1.1
Response Code: 404
Line-based text data: text/html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n
<html xmlns="http://www.w3.org/1999/xhtml">\n
<head>\n
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />\n
<title>404</title>\n
<link rel="stylesheet" href="errors.css" type="text/css" />\n
</head>\n
<body bgcolor="#64748B">\n
</head>\n
\n
<body>\n
<p> </p>\n
<p> </p>\n
<p> </p>\n
<p> </p>\n
<table width="918" border="0" align="center">\n
<tr>\n
<td width="156" rowspan="4" class="bodyText"><img src="exclaimation.gif" width="151" height="151" /></td>\n
<td class="bodyText"><span class="style5">HTTP Error 404: Inept or ham-handed user </span></td>\n
</tr>\n
<tr>\n
<td width="903" bgcolor="#FFFFFF" class="bodyText"><ol>\n
<strong>Emptiness</strong>:\n
[truncated] <li>The state of being empty; absence of contents; void space; vacuum; as, the emptiness of a vessel; emptiness of the stomach.</li><li>Want of solidity or substance; unsatisfactoriness; inability to satisfy desire; vac
<li><strong>Want of knowledge; lack of sense; vacuity of mind</strong>.</li>\n
</ol></p> </td>\n
</tr>\n
<tr>\n
<td bgcolor="#FFFFFF" class="style5"><div align="center">the page you asked for does not exist in our space-time continuum </div></td>\n
</tr>\n
<tr>\n
<td bgcolor="#999999"><p><a href="javascript:history.go(-1)">Go back</a>, thee, from whence thou came. And darken not this URL again. For if thou dost not heed my words, then thou dost have the brain of birds. Amen </p> </td>\n
</tr>\n
</table>\n
<p align="center"><a href="http://www.boredomsoft.org">Go To Main Page </a></p>\n
</body>\n
</html>\n
Packet capture, requesting erroneous URL:
Query:
Code:
No. Time Source Destination Protocol Info
20 5.876681 192.168.1.149 66.40.52.73 HTTP GET /;fjdngskdjfng;lskdjfnglskdjfglskdjfgksjdfgn HTTP/1.1
Hypertext Transfer Protocol
GET /;fjdngskdjfng;lskdjfnglskdjfglskdjfgksjdfgn HTTP/1.1\r\n
[Expert Info (Chat/Sequence): GET /;fjdngskdjfng;lskdjfnglskdjfglskdjfgksjdfgn HTTP/1.1\r\n]
Request Method: GET
Request URI: /;fjdngskdjfng;lskdjfnglskdjfglskdjfgksjdfgn
Request Version: HTTP/1.1
Host: www.boredomsoft.org\r\n
Response with no error document specified in CPanel:
Code:
No. Time Source Destination Protocol Info
22 5.905480 66.40.52.73 192.168.1.149 HTTP HTTP/1.1 302 Found HTTP/1.1 302 Found (text/html)
Hypertext Transfer Protocol
HTTP/1.1 302 Found\r\n
[Expert Info (Chat/Sequence): HTTP/1.1 302 Found\r\n]
Request Version: HTTP/1.1
Response Code: 302
Hypertext Transfer Protocol
HTTP/1.1 302 Found\r\n
[Expert Info (Chat/Sequence): HTTP/1.1 302 Found\r\n]
Request Version: HTTP/1.1
Response Code: 302
HTTP chunked response
Line-based text data: text/html
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">\n
<HTML><HEAD>\n
<TITLE>302 Found</TITLE>\n
</HEAD><BODY>\n
<H1>Found</H1>\n
The document has moved <A HREF="https://cp.freehostia.com/404/">here</A>.<P>\n
<P>Additionally, a 302 Found\n
error was encountered while trying to use an ErrorDocument to handle the request.\n
<HR>\n
<ADDRESS>Apache/1.3.33 Server at boredomsoft.org Port 80</ADDRESS>\n
</BODY></HTML>\n
Response with /errors/404.php specified in CPanel:
Code:
No. Time Source Destination Protocol Info
187 1.444362 66.40.52.73 192.168.1.149 HTTP HTTP/1.1 302 Found HTTP/1.1 302 Found (text/html)
Hypertext Transfer Protocol
HTTP/1.1 302 Found\r\n
[Expert Info (Chat/Sequence): HTTP/1.1 302 Found\r\n]
Request Version: HTTP/1.1
Response Code: 302
Location: /errors/404.php\r\n
Hypertext Transfer Protocol
HTTP/1.1 302 Found\r\n
[Expert Info (Chat/Sequence): HTTP/1.1 302 Found\r\n]
Request Version: HTTP/1.1
Response Code: 302
HTTP chunked response
Line-based text data: text/html
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">\n
<HTML><HEAD>\n
<TITLE>302 Found</TITLE>\n
</HEAD><BODY>\n
<H1>Found</H1>\n
The document has moved <A HREF="/errors/404.php">here</A>.<P>\n
<P>Additionally, a 302 Found\n
error was encountered while trying to use an ErrorDocument to handle the request.\n
<HR>\n
<ADDRESS>Apache/1.3.33 Server at boredomsoft.org Port 80</ADDRESS>\n
</BODY></HTML>\n
Followed by:
Code:
No. Time Source Destination Protocol Info
196 1.487887 192.168.1.149 66.40.52.73 HTTP GET /errors/404.php HTTP/1.1
Hypertext Transfer Protocol
GET /errors/404.php HTTP/1.1\r\n
[Expert Info (Chat/Sequence): GET /errors/404.php HTTP/1.1\r\n]
Request Method: GET
Request URI: /errors/404.php
Request Version: HTTP/1.1
And then:
Code:
No. Time Source Destination Protocol Info
295 2.011939 66.40.52.73 192.168.1.149 HTTP HTTP/1.1 404 Not Found (text/html)
Hypertext Transfer Protocol
HTTP/1.1 404 Not Found\r\n
[Expert Info (Chat/Sequence): HTTP/1.1 404 Not Found\r\n]
Request Version: HTTP/1.1
Response Code: 404
Line-based text data: text/html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n
<html xmlns="http://www.w3.org/1999/xhtml">\n
<head>\n
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />\n
<title>404</title>\n
<link rel="stylesheet" href="errors.css" type="text/css" />\n
</head>\n
<body bgcolor="#64748B">\n
</head>\n
\n
<body>\n
<p> </p>\n
<p> </p>\n
<p> </p>\n
<p> </p>\n
<table width="918" border="0" align="center">\n
<tr>\n
<td width="156" rowspan="4" class="bodyText"><img src="exclaimation.gif" width="151" height="151" /></td>\n
<td class="bodyText"><span class="style5">HTTP Error 404: Inept or ham-handed user </span></td>\n
</tr>\n
<tr>\n
<td width="903" bgcolor="#FFFFFF" class="bodyText"><ol>\n
<strong>Emptiness</strong>:\n
[truncated] <li>The state of being empty; absence of contents; void space; vacuum; as, the emptiness of a vessel; emptiness of the stomach.</li><li>Want of solidity or substance; unsatisfactoriness; inability to satisfy desire; vac
<li><strong>Want of knowledge; lack of sense; vacuity of mind</strong>.</li>\n
</ol></p> </td>\n
</tr>\n
<tr>\n
<td bgcolor="#FFFFFF" class="style5"><div align="center">the page you asked for does not exist in our space-time continuum </div></td>\n
</tr>\n
<tr>\n
<td bgcolor="#999999"><p><a href="javascript:history.go(-1)">Go back</a>, thee, from whence thou came. And darken not this URL again. For if thou dost not heed my words, then thou dost have the brain of birds. Amen </p> </td>\n
</tr>\n
</table>\n
<p align="center"><a href="http://www.boredomsoft.org">Go To Main Page </a></p>\n
</body>\n
</html>\n
Conclusions: .htaccess is being ignored. The server looks only to the CPanel setting for an error document. This error document is served along with a 302 header rather than a 404 header. If the error document specified in CPanel contains the PHP code to send a 404 response, this response is sent only AFTER the 302 response is sent, and is therefore useless.
HELP!