UnkwnTech
UnkwnTech

Reputation: 90921

Using domain name in htaccess rewrite

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.

Upvotes: 0

Views: 620

Answers (1)

Espo
Espo

Reputation: 41939

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.

Upvotes: 1

Related Questions