views:

42

answers:

2

Hi,

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 that 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?

A: 

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.

Fabian
good suggestion i read the notes about that on the defalt server error page! ill try that later.
lordsharp
although that wouldnt explain why im getting the same problem in Ch + Op
lordsharp
A: 

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

Lizard
THE 310 / 301, thats just a mistake i made whilst typing the question on here. I'm deliberately using a 301 because im working on a similar site to bit.ly . Im using the 404 htaccess error to load the php page when a user tries to view a directory that doesnt exist eg hhtp://yourdomain.com/3h5i435, (instead of the default htmls docs) which then does the 301 header redirect.
lordsharp
Why not use ModRewrite?
Lizard