Apache ErrorDocument with absolute path
Asked Answered
L

1

6

I have a server with several virtual hosts. Now I want to set up the error documents for the whole server. I have located my error sites in /var/www/error/*, but with the ErrorDocument directive I am only able to set the error document relative to the document root, but I want to use the absolute path (e.g /var/www/error/404.html).

Has anyone an idea how I can get this?

Languor answered 22/7, 2010 at 17:5 Comment(0)
G
10

I don't think this can be done directly inside the statement: The ErrorDocument will always have to be relative to the DocumentRoot. According to the docs, the only alternative seems to be specifying an external URL, but that is bad because the wrong response header gets sent (302 instead of 404).

You could try whether anything is possible using an Alias directive or - I'm sure this would work - a symbolic link:

ErrorDocument 404 /symlinked_page.php
Gallium answered 22/7, 2010 at 17:9 Comment(2)
I get an "Alias not allowed here". @SvenWalter, where did you put it?Karolkarola
@minitech Apparently the Alias directive doesn't work in .htaccessExtravagate

© 2022 - 2024 — McMap. All rights reserved.