header("Location:http://www.bKjia.c0m/");
?>
代码如下 |
复制代码 |
$url=$_GET["url"];
header("Location:".$url);
?>
|
or:
header("location:index123.php"); ?>
代码如下 |
复制代码 |
$url=""];
header("HTTP/1.1 301 Moved Permanently");
header ("Location:$url");
?>
|
Get the value through get or post and then jump
Sometimes you can see http://www.xxx.com/url.php?url=http://www.baidu.com, and then jump to Baidu.
How to implement this url jump using php?
It can be achieved with just a few simple lines of code.
The code is as follows
|
Copy code |
|
$url=$_GET["url"];
header("Location:".$url);
?>
PHP 301 redirection implementation code
The code is as follows
|
Copy code
$url=""];
header("HTTP/1.1 301 Moved Permanently");
header ("Location:$url");
?>
See status code in ff
It’s easy. If you want to test, just use the curl software to check.
#curl -I
HTTP/1.0 301 Moved Permanently
Date: Tue, 06 May 2008 06:27:39 GMT
Server: apache
Location:
If you see the above HTTP/1.0 301 Moved Permanently
http://www.bkjia.com/PHPjc/629022.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/629022.htmlTechArticle Below we summarize several methods of page jump in php. To achieve jump in php, you need to use The header function, I will introduce it one by one below, friends in need can refer to it. The simplest...
|
|
|