Welcome to WebmasterWorld Guest from 54.198.93.179

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Apache Custom 404 Configuration Problem

Server sends a 302

     
9:27 pm on Oct 24, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Okay - is it me or is it the server?

I have an .htaccess file that is supposed to serve a custom 404.

[quote]


ErrorDocument 404 http://www.example.com/missing.html

[quote]

With this code, the site shows the appropriate 404 page. Except when I did a server header check, the server headers are producing a 302 found message instead of a 404.

Is that something badly configured on the server end, or have I somehow messed up something as simple as this one line of instruction.

Just for the record, the server does show 404 in the header if I remove the htaccess file.

any ideas?

9:37 pm on Oct 24, 2003 (gmt 0)

10+ Year Member



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

9:57 pm on Oct 24, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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?

10:55 pm on Oct 24, 2003 (gmt 0)

10+ Year Member



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 [,...] 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?

11:12 pm on Oct 24, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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.

11:21 pm on Oct 24, 2003 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



PatrickDeese,

> 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].

Jim

10:40 am on Oct 25, 2003 (gmt 0)

10+ Year Member



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.

3:33 pm on Oct 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> 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.

6:58 am on Oct 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hi patrick,

i had exactly the same error last night.

but mine worked with one virtual domain and didn't with the other!?*! ;)

(http://www.webmasterworld.com/forum92/498.htm)

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?

 

Featured Threads

Hot Threads This Week

Hot Threads This Month