McCordRm Posted August 3, 2012 Share Posted August 3, 2012 So I want to create a header which changes based on the Domain it's located at. For example: Site 1: http://www.signsofmadness.com Site 2: http://www.signsoflove.org Site 3: http://www.signsofaddiction.com If I upload the index.html page to all three sites, the title of the site should read across the top: Site 1: Signs of Madness Site 2: Signs of Love Site 3: Signs of Addiction Am I making sense? Link to comment https://www.neowin.net/forum/topic/1095925-regex-help-maybe/ Share on other sites More sharing options...
0 Phouchg Posted August 4, 2012 Share Posted August 4, 2012 Why bother? Substring from position of signsof + 8 to next . from there in your prefered scripting language could do. Link to comment https://www.neowin.net/forum/topic/1095925-regex-help-maybe/#findComment-595058647 Share on other sites More sharing options...
0 +chorpeac MVC Posted August 4, 2012 MVC Share Posted August 4, 2012 http://stackoverflow.com/questions/3442333/php-regex-get-domain-from-url Look at the second to last and last posts. http://([^/]+).* Or '/http:\/\/([^\/]+)\//i' Link to comment https://www.neowin.net/forum/topic/1095925-regex-help-maybe/#findComment-595058665 Share on other sites More sharing options...
0 CrispCreations Posted August 4, 2012 Share Posted August 4, 2012 You don't really need a regex for this, the $_SERVER global in php has an HTTP_HOST value you can test against switch ($_SERVER["HTTP_HOST"]) { case 'www.example.com': // do stuff for www.example.com break; case 'www.example1.com': // do stuff for www.example1.com break; // add more cases as needed } Link to comment https://www.neowin.net/forum/topic/1095925-regex-help-maybe/#findComment-595059201 Share on other sites More sharing options...
Question
McCordRm
So I want to create a header which changes based on the Domain it's located at.
For example:
Site 1: http://www.signsofmadness.com
Site 2: http://www.signsoflove.org
Site 3: http://www.signsofaddiction.com
If I upload the index.html page to all three sites, the title of the site should read across the top:
Site 1: Signs of Madness
Site 2: Signs of Love
Site 3: Signs of Addiction
Am I making sense?
Link to comment
https://www.neowin.net/forum/topic/1095925-regex-help-maybe/Share on other sites
3 answers to this question
Recommended Posts