Monday, 9 April 2007

Actual and requested server name

There are differences between requested server name and actual server name. Because of aliases this may vary, but you could get both by apache environment variables. In Parser 3 it is as easy as an apple.



Assume you have a website at at www.hoogabooga.com and a bunch of aliases pointing to it:



$env:SERVER_NAME will get you an www.hoogabooga.com (actually it's an value of ServerName apache directive).


$env:HTTP_HOST gets whatever.hoogabooga.com that was input into the address box of the browser.

No comments: