【发布时间】:2011-09-08 08:38:24
【问题描述】:
我在 wordpress 中使用下面的代码进行重定向
$currentPage = explode('?', $_SERVER ['REQUEST_URI']);
$current_page_url = $currentPage[0];
if($current_page_url == '/e-commerce')
{
header("Location : http://www.mysite.com/complete-e-commerce-solution",true);
}
我在 header.php 中使用此代码,我正在重定向到第三方站点。是这个问题吗?
【问题讨论】:
-
您收到的错误或结果究竟是什么?
-
$currentPage的值是多少 -
@Ross 我仅将 $currentPage 的值设为 /e-commerce。但重定向没有发生
-
我的意思是
$current_page_url的值,我的错。因此,如果您执行print_r($currentPage); exit;,您会得到什么输出?我假设这是在任何其他输出之前? -
你为什么要使用 php 呢?
htaccess不够吗?