LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   .htaccess ErrorDocument and IE (https://www.linuxquestions.org/questions/linux-software-2/htaccess-errordocument-and-ie-46504/)

BaerRS 02-21-2003 09:39 AM

.htaccess ErrorDocument and IE
 
OK... I know this question is not fully an Linux question.. sence I am asking info on IE.. but here goes...

I have set up apache... and in a test dir i have created a .htaccess file with the following line:

ErrorDocument 404 /error-404.php

Wich works fine in Mozilla.. it brings up the page..
in IE it does not.. It uses IE's default 404 page...

I do have a 404 page that does work..(html)... for the whole site...
but onece I have this entry in the .htaccess file.. it no longer uses the site 404 page.. or the php 404 page...

I have set this up at:

http://www.swingcolumbus.com/test/
http://www.swingcolumbus.com/test/Bad-Link.html

here some code if you want it

error-404.php
**************************************
<?php

print "<br>\n Your IP address appears to be <b>$REMOTE_ADDR</b> <p>\n";

$SMURF = exec("host $REMOTE_ADDR 2> /dev/null | grep -i name | \
head -1 | awk '{print $5}'");
if ($SMURF != "")
{
print "This address maps to the name <b>$SMURF</b> <p>\n";
}
print "You appear to be running <b>$HTTP_USER_AGENT</b> <p>\n";

if ($HTTP_REFERER != "")
{
print "You readhed this page by clicking a link at ";
print "<b><a HREF=$HTTP_REFERER>$HTTP_REFERER</a>.</b><p>\n";
}
?>

DaveG 02-21-2003 02:20 PM

Find out what Apache is actually sending. I use "wget -S --spider ..." to check the headers.

I think different IE versions do different things, but at the top of your PHP script you could try "headers('HTTP/1.0 400 Not Found');" and "headers('HTTP/1.0 200 OK');" to see how your browser reacts.

If you can't figure it out, find a site that does what you want and try "wget -S $URL" to steal it. Just set up the same headers in PHP. You may need to buffer the output (or build a string) if you need to send content-length headers.

Obi Perrin 02-21-2003 04:15 PM

As far as I remember, IE rejects custom error pages that are under a certain size, and instead uses it's own. Try increasing the filesize of the page?

BaerRS 02-21-2003 06:17 PM

Ding Ding Ding...

Thanks Obi Perrin,
You hit the nail on the head !!
I would have never in a million years thought of that.
I still am in disbelief... but it worked..

Thanks again..
Hopefully I can help you out some day...


Scott


All times are GMT -5. The time now is 01:48 AM.