Forum Moderators: coopster

Message Too Old, No Replies

Same site, different domains, different content

How do I get different content to display depending on the domain name used

         

joshuas

8:02 pm on Feb 7, 2006 (gmt 0)

10+ Year Member



Right now I have two different domain names which differ only in extension (mysite.org and mysite.com).

I want to be able to display the same site at both domains. However, I want the content displayed - such as the header image - to be dynamically chosen depending on which domain name the user is using. If the user types "mysite.com" into the browser, I want an image with "mysite.com" to come up; if a user types "mysite.org" into the browser, I want an image with "mysite.org" to appear.

I hope that my description of what I want to do is clear.

At the moment, both domains point to the same folder (/mysite.com/www) on the server.

Any implementation ideas or help you can give would be fantastic. Thanks!

vevs

8:38 pm on Feb 7, 2006 (gmt 0)

10+ Year Member



you can use this piece of code to show different image depending on the domain

<?
if (strpos(getenv('SERVER_NAME'), 'mysite.com')!==false) {
echo "<img src='com_header.jpg'>";
} elseif (strpos(getenv('SERVER_NAME'), 'mysite.org')!==false) {
echo "<img src='org_header.jpg'>";
};
?>

joshuas

1:06 am on Feb 8, 2006 (gmt 0)

10+ Year Member



That worked great.

Thanks