Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
htaccess中的重定向和php_Php_Apache_.htaccess_Mod Rewrite - Fatal编程技术网

htaccess中的重定向和php

htaccess中的重定向和php,php,apache,.htaccess,mod-rewrite,Php,Apache,.htaccess,Mod Rewrite,当升级到新的php版本(现在我有5.5.9)时,我面临一个奇怪的问题 我的旧.htaccess告诉我: Options +FollowSymlinks RewriteEngine on RewriteCond %{HTTP_HOST} ^example.com [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] direct.php将包含例如: <?php if ($id == "") {$link = "http:

当升级到新的php版本(现在我有5.5.9)时,我面临一个奇怪的问题

我的旧.htaccess告诉我:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$  http://www.example.com/$1 [R=301,L]
direct.php将包含例如:

<?php 
if ($id == "") {$link = "http://www.example.com";}
if ($id == "10") {$link = "http://google.com";} 
header("Location: $link"); 
exit;
?>
应该把我引向google.com,但它不再工作了,只是在它工作正常之前把我引向www.example.com。
我假设在php中传递的变量发生了变化,或者只是我的htaccess代码

似乎
寄存器\u globals
是问题所在

在顶部添加以下行:

$id = $_GET['id'];

在使用$id之前添加此项:
$id=$\u GET['id']

$id = $_GET['id'];