如何将用户重定向到另一个页面?
答
<?php
Header("HTTP/1.1 301 Moved Permanently");
Header("Location: http://www.new-url.com");
exit();
?>
永久移动是什么帮助搜索引擎。
答
if($condition){
header('Location: http://example.com');
exit();
}
会做到这一点。别忘了exit()
!
+0
搜索引擎? – Shoe 2011-02-01 15:41:06
答
<?php
Header("HTTP/1.1 302 Moved Temporarily");
Header("Location: http://www.new-url.com");
exit();
?>
答
<?php
/* Redirect browser */
header("Location: http://www.google.com");
/* Make sure that code below does not get executed when we redirect. */
exit;
?>
相反的http://www.google.com,要驳你的页面,您可以编写自己的网址。
@Col:看起来Daniel A. Lemming在下面提供了一个很好的答案。 – 2011-02-01 18:58:38
@罗伯特哈维你不能确定 – 2011-02-02 06:19:48