Page 1 of 1

Defining HTTP_SERVER variable

Posted: Tue Nov 20, 2007 7:31 am
by tristanlee85
Here is how the variable is setup right now:

Code: Select all

define('HTTP_SERVER', 'http://www.singalongtracks.com');
So, say the user comes to the site via http://singalongtracks.com (no WWW), the next link they click on it going to change everything to http://www.singalongtracks.com since that's how the variable is defined. What I'm looking to do is make the variable dynamic so if the user doesn't type in the www, it doesn't change throughout the site. Also, other domain names link to this same site as well so I can't simply make it add or remove the www depending on the circumstance. I need to set the variable to the domain the user first comes to the site with.

I've moved away from PHP for a while so I'm a bit rusty.

Posted: Tue Nov 20, 2007 9:16 am
by Christopher
Take a look at $_SERVER["SERVER_NAME"].