Redirect 添加301重定向到php文件

Redirect 添加301重定向到php文件,redirect,Redirect,我需要向我的站点添加一些链接,我使用名为redirect.php的文件重定向了这些链接,代码如下: <? header("HTTP/1.1 301 Moved Permanently"); $linkid = $_GET['linkid']; if ($linkid == "1234") {$link = "http://advertiserlink.co.uk/";} header("Location: $link"); exit(); ?> 我想问一下,从301重定向的

我需要向我的站点添加一些链接,我使用名为redirect.php的文件重定向了这些链接,代码如下:

<? header("HTTP/1.1 301 Moved Permanently");
$linkid = $_GET['linkid'];
if ($linkid == "1234") {$link = "http://advertiserlink.co.uk/";}
header("Location: $link");
exit();
?>  

我想问一下,从301重定向的角度来看,这是否正确,谷歌将无法找到我将在我的文本中放置的链接:例如。我还禁止在robots.txt中使用redirect.php。
提前谢谢

它在我的电脑上工作

<?php
    $link = ($_GET['link'] == '1234) ? 'http://my1234.example.com/' : 'http://example.com/';
    header('HTTP/1.1 301 Moved Permanently');
    header('Location: ' . $link);
    exit();
?>

是的,它在这里也起作用,但我不确定谷歌是否会“接受”301重定向并忽略这一点:谢谢!