Posts: 16
Name: Kiros
Location: Albany, LA - USA
|
Hey, could anyone explain to me what this code do - mainly, the two rules at the end? I'm somewhat new to .htaccess syntax and whatnot
Code:
# subdomain logic
RewriteEngine On
RewriteOptions inherit
RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
RewriteCond %{HTTP_HOST} !^domain\.com [NC]
RewriteCond %{HTTP_HOST} ^([A-Z0-9a-z-]+)\.domain\.com [NC]
RewriteCond %{DOCUMENT_ROOT}/%1 -d
RewriteRule ^(.+) %{HTTP_HOST}/$1 [C]
RewriteRule ^([0-9A-Za-z-]+)\.domain\.com/?(.*)$ %{DOCUMENT_ROOT}/$1/$2 [L]
# end subdomain logic
The problem is my server always sends a "Vary: Host" HTTP header with subdomains. This causes my subdomains to not work correctly with IE and all of it's shell-browsers. I can see that the first two RewriteCond-itions basically exclude the base domain and www prefix - which, possibly by coincidence, do not have the "Vary: " HTTP header problem.
Could anyone confirm what the two rules actually do?
Thanks,
//KiroS
|