Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

maclover001

macrumors 6502a
Original poster
Mar 25, 2008
895
0
Vancouver, Canada
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
 

maclover001

macrumors 6502a
Original poster
Mar 25, 2008
895
0
Vancouver, Canada
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

macrumors 68040
Oct 25, 2004
3,540
272
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

macrumors 6502a
Original poster
Mar 25, 2008
895
0
Vancouver, Canada
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.