开发者

.htaccess cross browser

开发者 https://www.devze.com 2023-01-03 07:27 出处:网络
Im trying to load a custom error document for a 404 error using a .htaccess file on a linux server, the page gets the current page URL then redirects to another site (which is retrieved from a db) bas

Im trying to load a custom error document for a 404 error using a .htaccess file on a linux server, the page gets the current page URL then redirects to another site (which is retrieved from a db) based on an id it retrieved from the URL.

The current error documents are stored here:

/error_docs/ - i dont have permission to upload anything other than the HTML files th开发者_JAVA技巧at are already in there

/HTTPDocs/301redir.php is the site root where the .htaccess file is.

i have used the following to load the 301redir.php page as the error doc, which works in FF but no other browsers.

ErrorDocument 404 /310redir.php

using .htaccess is my only real option for changing this, is there a way to get around this issue and make it work across all browsers?


Maybe your file is too small, see the following excerpt from the apache docs:

Microsoft Internet Explorer (MSIE) will by default ignore server-generated error messages when they are "too small" and substitute its own "friendly" error messages. The size threshold varies depending on the type of error, but in general, if you make your error document greater than 512 bytes, then MSIE will show the server-generated error rather than masking it. More information is available in Microsoft Knowledge Base article Q294807.


That should work fine, try putting the full URL http://www.yourdomain.com/301redir.php

I also note that youu said 310redir.php is your example but 301redir.php in your description (note 310 and 301).

Also don't forget to add header("HTTP/1.1 404 Not Found"); if you are doing a 404

0

精彩评论

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