Question:
Running a website on 2 different domains?
vicky5
2008-10-16 04:46:32 UTC
I would like my website to be accessed via two different domains. I will also use different style sheets (colors and fonts) for those two domains depending upon the domain name used by user.

For e.g. www.site1.com and www.site2.com will be the same one website but if a user types www.site1.com then entire website would run on this domain. For e.g. contact page should have this URL
www.site1.com/contact.html

If a user comes to site using www.site2.com then he should see site2 name in every URL i.e. www.site2.com/contact.html

How is this possible?

I understand that domain forwarding will not solve this. So what should I do to make this happen?

Thanks.
Four answers:
ZTat
2008-10-16 05:06:27 UTC
Assuming your websites run on the same machine, you will need a script that will parse the url and act according to it. You will need to install PHP or other programming language for websites on your server, such as ASP.



In PHP, that can be (use contact.php instead of contact.html !!!):






$domain = $_SERVER['SERVER_NAME'];

if($domain == "www.site1.com")

echo "Welcome to Site1 Insert HTML Code HERE";

else

echo "Welcome to Site2 Insert HTML Code HERE";



echo "
Domain entered is: $domain";

?>



I think that pure HTML can't do what you want.



You can also use a cookie to manage this in PHP...
Mad Dog Laurie
2008-10-16 05:04:25 UTC
Look up Apache and virtual domains in Google
Agog85
2008-10-16 05:06:31 UTC
you need to load 2 different themes on the same IIS server.



you need to have 2 public IPs,



first public IP refers to the first link (1st domain name)



and the second public IP refers to the 2nd link (2nd domain name).



let the 2 public IPs refer to the same server (webserver).
David G
2008-10-16 05:52:17 UTC
Your web host must support multiple domain names. Something like: http://bluehost-service.atspace.com


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...