• 0

Regex help... maybe?


Question

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

  • 0

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
}

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.