开发者

Send http 404 header and show content

开发者 https://www.devze.com 2023-03-12 12:36 出处:网络
Im want send header 404 Not found and show my page \"error not found开发者_如何学Python. try to see this...\".

Im want send header 404 Not found and show my page "error not found开发者_如何学Python. 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?


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.


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.


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
0

精彩评论

暂无评论...
验证码 换一张
取 消