如果阅读一些帖子并编写此代码…但这行不通。我有2个域名在同一个托管帐户。我喜欢将访问者重定向到flash或WordPress网站,这取决于他们使用的域名。这是我的代码:
<?php
$host = $_SERVER['SERVER_NAME'];
if($host == 'elfarosociedades.com.ar' or $host == 'http://www.elfarosociedades.com.ar/' or $host == 'http://elfarosociedades.com.ar/' or $host == 'www.elfarosociedades.com.ar') {
header('Location: http://www.elfarosociedades.com.ar/index.php');
else
header('Location: http://villarincondelsol.com.ar/home.html');
}
?>
try this
<?php
$host = $_SERVER['HTTP_HOST'];
$hosts=array(
'elfarosociedades.com.ar' ,
'http://www.elfarosociedades.com.ar/' ,
'http://elfarosociedades.com.ar/' ,
'www.elfarosociedades.com.ar'
);
if(in_array($host, $hosts)) {
header('Location: http://www.elfarosociedades.com.ar/index.php');
}else {
header('Location: http://villarincondelsol.com.ar/home.html');
}
?>