I have two domain names and only one host. The fact is that my host doesn't accept multiple domain names. I asked to the support of my host how can I do and they gave me a part of code. My problem is that this code is not working for me. Can someone help me please?
<?php
$host = getenv('HTTP_HOST');
if($host == "www.domain1.ch"){
header("Location: http://www.domain1.ch/index1.htm");
}
else if($host == "www.domain2.ch"){
header("Location: http://www.domain2.ch/subfolder2/index.htm");
}
?>
On my admin panel of my host, I define a redirection of my second domain name to a php page that contain this code.
Thank you in advance,
Nicolas
try this
<?php
$host = $_SERVER['SERVER_NAME'];
if($host == "www.domain1.ch"){
header("Location: http://www.domain1.ch/index1.htm");
}
else if($host == "www.domain2.ch"){
header("Location: http://www.domain2.ch/subfolder2/index.htm");
}
?>