Apache mod_rewrite: explain me %{HTTP_HOST} expecially when using addon domains
Situation (directories tree) on an Apache server with addon domains:
main-domain.com/
|
|_ .htaccess (just an empty file, no rule in here)
|_ index.html (shown when accessing http://main-domain.com)
|
|_ addon-domain-1.com/
| |
| |_ .htaccess
| |_ index.html (shown when accessing http://addon-domain-1.com or http://main-domain.com/addon-domain-1.com/)
|
|_ addon-domain-2.com/
|
|_ .htaccess
|_ index.html (shown when accessing http://addon-domain-2.com or http://main-domain.com/addon-domain-2.com/)
Let's say in "addon-domain-1.com/.htaccess" file I have some rule using %{HTTP_HOST} like:
RewriteCond %{HTTP_HOST} ^something$
Does %{HTTP_HOST}
evaluates to the domain of the currently requested url on server???
So if asking for:
%{HTTP_HOST} will be "addon-domain-1.com"?
http://addon-domain-1.com (without final slash)
%{HTTP_HOST} will still be "addon-domain-1.com"?
%{HTTP_HOST} will still be "www.addon-domain-1.com"?
And when asking for:
http://main-domain.com/addon-domain-1.com
%{HTTP_HOST} will be "main-domain.com"???
or "main-domain.com/addon-domain-1.com"???
%{HTTP_*}
evaluates to the HTTP header with the name given after the prefix shown. In HTTP 1.1, the host being accessed is given in the Host
header, so yes.