With php
Use $ _SERVER ['HTTP_HOST'] to get your domain, and then execute the switch statement to change the image variable.
<?php switch($_SERVER['HTTP_HOST']) { case 'acme.com': case 'www.acme.com': $image = "acmecom.jpg" break; case 'acme.co.uk': case 'www.acme.co.uk': $image = "acmecouk.jpg" break; default: $image = "default.jpg" break; } ?>
If you use www before acme.com, you need to change the address from “acme.com” to “www.acme.com”. Same for .co.uk.
In your header image, you then repeat the image path as follows:
<img src="path/to/folder<?php echo $image;?>" alt="header-image" />
source share