views:

138

answers:

1

I host several sites (name based in apache) and I currently have an htaccess that has an error handler

ErrorDocument 404 http://mydomain.com/errorDocs/404.htm

is there a way for me to pass the domain name that the error came from I want to do some basic redirection.

I need something like this:

ErrorDocument 404 http://mydomain.com/errorDocs/404.htm?host=%{HTTP_HOST}

however this does not provide the doamin and get printed as plain text.

+1  A: 

It is not possible to use variables in the ErrorDocument directive. However, you could point the 404 error-document to a script, and then have the script sort out what domain the request is coming from by reading the HTTP_REQUEST variables.

Espo
The problem with that is that the error document is typically on a different domain so I don't have a reliable way to determine the domain that it comes from.
Unkwntech
You could place the errordocument-script on all the domains, and then do a redirect to the correct domain from each of them, with the "invalid" domain in the querystring?
Espo