1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Ughh... how do you use the SAME 404 page for every VirtualHost

Discussion in 'Mac OS X Server, Xserve, and Networking' started by maclover001, May 19, 2009.

  1. macrumors 6502a


    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?

  2. macrumors 6502

    I believe you'd have to make a copy of the 404 error page on each virtual host.
  3. macrumors 6502a


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

    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.
  5. macrumors 6502a


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


    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.
  7. macrumors 6502a


    Thanks, I'll try it.

Share This Page