PDA

View Full Version : Ughh... how do you use the SAME 404 page for every VirtualHost




maclover001
May 20, 2009, 12:08 AM
I tried setting the ErrorDocument for 404 in httpd.conf, and leaving the "Error Document" field in Server Admin blank for every virtual host, but that causes Server Admin to complain that the server can't be started because of "Duplicate ErrorDocument arguments".

If I just paste in the exact http address of the document I want to use into every field, then that causes that URL to actually show instead of the url that the user typed.

How can I use the exact same 404 document for every virtual host, while keeping the original URL in the address bar?

Thanks



SHIFTLife
May 20, 2009, 08:24 AM
I believe you'd have to make a copy of the 404 error page on each virtual host.

maclover001
May 20, 2009, 10:12 AM
I believe you'd have to make a copy of the 404 error page on each virtual host.

Tried that. It worked, but it doesn't show the CSS stylesheet :confused::confused:

SHIFTLife
May 20, 2009, 10:16 AM
Tried that. It worked, but it doesn't show the CSS stylesheet :confused::confused:

When you do that, make sure you're copying your stylesheet and modifying the 404 page to reference the stylesheet that's actually in that VirtualHost's directory.

maclover001
May 20, 2009, 10:19 AM
When you do that, make sure you're copying your stylesheet and modifying the 404 page to reference the stylesheet that's actually in that VirtualHost's directory.

I did. Going to the file physically (mydomain.com/errordocs/404.html) works, but actually triggering a 404 causes the stylesheet to not show.

iSee
May 20, 2009, 12:20 PM
The client's browser loads the css. I'm guessing the path in 404.html specifies the css file using a url relative to /errordocs/404.html. But from the client's perspective, the page was loaded from the url they typed.

You'll want to use a relative url that is valid no matter what the original url typed was. e.g., "/errordocs/404.css" might work, depending on how your site(s) are set up.

maclover001
May 20, 2009, 03:11 PM
The client's browser loads the css. I'm guessing the path in 404.html specifies the css file using a url relative to /errordocs/404.html. But from the client's perspective, the page was loaded from the url they typed.

You'll want to use a relative url that is valid no matter what the original url typed was. e.g., "/errordocs/404.css" might work, depending on how your site(s) are set up.

Thanks, I'll try it.