1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

404 Error Page Won't Load On IE 6 and IE 7

Discussion in 'PHP' started by kidblogger, Aug 21, 2007.

  1. #1
    Wow, this surprised me, I didn't realized that ALL THE TIME my blog's 404 won't load! Geesh, that's a sucker.

    You see, I'm using wordpress (My blog is at http://www.carlocab.com ) and wordpress themes has a 404 page included. I was just wondering why this happened, it loaded in firefox but not on IE. See it for your self. try it on IE and firefox.

    Darn, I need to fix this :(
     
    kidblogger, Aug 21, 2007 IP
  2. Matts

    Matts Berserker

    Messages:
    195
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    108
    #2
    The only thing that comes to my mind is that you're on a php/cgi machine and the header() format is different in cgi vs module php. Could be your 404 handler in your theme hasn't been patched for this and isn't sending the proper header for the cgi:

    Look in the 404.php file for:
      if ( !empty($error) && '404' == $error ) {
    PHP:
    if all you see is:
    @header('HTTP/1.1 404 Not Found');

    Replace it with:

     
           if ( preg_match('/cgi/', php_sapi_name()) )
     		@header('Status: 404 Not Found');
     	else
     		@header('HTTP/1.1 404 Not Found');
          }
    
    PHP:
    Matt
     
    Matts, Aug 21, 2007 IP
  3. kidblogger

    kidblogger Active Member

    Messages:
    791
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    70
    #3
    Wow, I didn't see anything like that from the 404.php file :(
     
    kidblogger, Aug 22, 2007 IP
  4. sabmalik

    sabmalik Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    dont know how you are going about this but i checked the headers you are sending ..... it says
    404 OK
    which is incorrect .. IE is treating it correctly by showing its own 404 page .. try to send 200 OK instead of 404 OK
     
    sabmalik, Aug 22, 2007 IP
  5. kidblogger

    kidblogger Active Member

    Messages:
    791
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    70
    #5
    Uhhh... where can I see that?
     
    kidblogger, Aug 23, 2007 IP
  6. sabmalik

    sabmalik Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    what are you using for 404 pages? a plugin or 404.php file ?
     
    sabmalik, Aug 23, 2007 IP
  7. kidblogger

    kidblogger Active Member

    Messages:
    791
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    70
    #7
    404.php file. It's a wordpress
     
    kidblogger, Aug 25, 2007 IP
  8. sabmalik

    sabmalik Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    do you see something like this in the file?

    header("HTTP/1.1 404 OK");

    if yes change 404 to 200.
     
    sabmalik, Aug 28, 2007 IP
  9. xemiterx

    xemiterx Peon

    Messages:
    62
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #9
    That is a strange one. If I refresh the page enough times in IE I get the correct error page, but mostly it gives the IE default 404 message. Firefox always gives the correct one.

    Here are your response headers:
    Date: Wed, 29 Aug 2007 03:09:22 GMT
    Server: Apache/1.3.37 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.28 OpenSSL/0.9.7a PHP-CGI/0.1b
    Cache-Control: no-cache, must-revalidate, max-age=0
    Expires: Wed, 11 Jan 1984 05:00:00 GMT
    Pragma: no-cache
    X-Pingback: http://www.carlocab.com/xmlrpc.php
    X-Powered-By: PHP/4.4.4
    Set-Cookie: wwsgd_visits=8; expires=Thu, 28 Aug 2008 03:09:22 GMT; path=/
    Last-Modified: Wed, 29 Aug 2007 03:09:22 GMT
    Keep-Alive: timeout=10, max=100
    Connection: Keep-Alive
    Transfer-Encoding: chunked
    Content-Type: text/html; charset=UTF-8
    
    404 OK
    PHP:
    Here are response headers from Microsoft.com
    Cache-Control: no-cache
    Pragma: no-cache
    Content-Type: text/html; charset=iso-8859-1
    Expires: -1
    Server: Microsoft-IIS/7.0
    X-AspNet-Version: 2.0.50727
    P3P: CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"
    X-Powered-By: ASP.NET
    Date: Wed, 29 Aug 2007 03:17:14 GMT
    Content-Length: 16820
    
    404 Not Found
    PHP:

    Notice the difference from 'OK' and 'Not Found'.

    I found this at wordpress.org
    I suggest looking in your 404.php file to look for that line, perhaps it was written wrong by your template designer or it is missing and needs to be added.
     
    xemiterx, Aug 28, 2007 IP
    kidblogger likes this.
  10. kidblogger

    kidblogger Active Member

    Messages:
    791
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    70
    #10
    Wow, thanks xemiterx! worked fine for me now.

    Green rep added :D
     
    kidblogger, Aug 31, 2007 IP