1

Im want send header 404 Not found and show my page "error not found. try to see this...". But when im send header i see native-browser page "Oops! This link appears to be broken.". How i can show my page content with correct header? Any idea?

Kein
  • 977
  • 2
  • 12
  • 32

3 Answers3

4

Some browsers think their error pages are smarter than the website's. As far as I know, only Google Chrome and Internet explorer do so.

When they receive a response shorter or equal in length to 512 bytes, they decide the page is 'not descriptive enough', and show their own 404 error document. You may want to add a padding comment to your page to bypass this check; or even better, useful content to describe what happened to the user.

zneak
  • 134,922
  • 42
  • 253
  • 328
3

Some browsers won't show your 404 page unless it's a certain number of bytes (512 is common). This question will probably help you out a bit.

Community
  • 1
  • 1
zastrowm
  • 8,017
  • 3
  • 43
  • 63
1

I believe that's something that happens at the HTTP server level. Therefore, you'll have to change your settings there. I think in Apache you can add this to your .htaccess or httpd.conf file:

ErrorDocument 404 /location/to/your-404.php
Abe Voelker
  • 30,124
  • 14
  • 81
  • 98