im试图将到达我网站的流量从Twitter重定向到另一个。我有下一个代码,但无法正常工作。
<?php
$referencia = $_SERVER['HTTP_REFERER'];
$referencia = str_replace("http://","", $referencia);
$referencia = str_replace("https://","", $referencia);
$referencia = str_replace("www.","", $referencia);
$peces2 = explode("/", $referencia);
if($referencia == 't.co') {
$a = 'https://www.anotherwebsite.com';
$website = $a;
header('HTTP/1.1 301 Moved Permanently');
header('Location: ' . $website);
exit;
}
?>