The 302 redirect is normal when you specify a full URL.
If you intend to redirect to a page on the same domain, use the form of the page name relative to the root, i.e.
ErrorDocument 404 /missing.html
Thank you for replying. The problem is using the entire domain name is the only way that I can actually get the correct file to be served.
I think it has something to being on a shared server? The main reason is that I don't want to serve Bots 302 responses when they are really 404s.
Is there anything that I can insert into the 404 document file to have the same effect - NoIndex, NoFollow for instance....
Or is there a better solution?
|The problem is using the entire domain name is the only way that I can actually get the correct file to be served. |
Do you mean the file is in the same domain, but specifying it as /missing.html doesn't work, or do you mean it has to be at a different domain? Is one domain http:// and one https://, or a different port?
The way ErrorDocument works, it WILL give a 302 if the full url is given. Specifying a filename, WITH the path from the server root, should normally work, and that's what you want to aim at getting to work - 404 with a full url won't.
You mention being on a shared server - maybe you need to add further path information in the name to ensure it goes to your directory from the server root? For example if you're [widget.com...] then your error document might be /~patrick/missing.html etc?
By shared server - I mean a semi-dedicated server with a list of domains in the admin root, and each domain name assigned its own unique IP. ie a folder for example.com and another for example2.com etc.
The problem is that I am using the client's host to adminstrate a number of his domains so I don't exactly know much about the set up accept I have been given admin access.
When I use the htaccess file with a non-qualified url (not fully qualified URL), the server ignores the custom 404. The only way I can make it work is by using the entire domain.
I am guessing that this is something the webhost has to work out.
> something the webhost has to work out.
It certainly sounds like it... The solutions presented here are 100% correct, and Apache specifically warns about the 302 problem when using canonical URLs for 40x errors in the ErrorDocument documentation [httpd.apache.org].
|I am guessing that this is something the webhost has to work out. |
If it's a multi-domain virtual server then the setup can be unusual, so yes. You need to find out what prefix your missing.html needs to be reachable from the server root. It needs that prefix (e.g. /mydomain/missing.html or more) to work.
> e.g. /mydomain/missing.html or more
I tried a few combinations but none seemed to work. My client is going to contact tech support on Monday. Thanks for the pointers.
i had exactly the same error last night.
but mine worked with one virtual domain and didn't with the other!?*! ;)
i tried this morning and suddenly it worked perfectly. i did nothing to change it overnight (except dream about it a lot - subliminal persuasion? ;)
the only thing which occurs to me now is that is might have been an IE bug.
have you tried accessing your missing page with netscape or opera?