The simplest is to use php header to implement
The code is:
| The code is as follows: |
Copy code |
|
<? Php
Header ("Location: http://www.111cn.net /");
?>
Or:
<? Header ("location: index123.php");?> |
Get the value through get or post before redirecting
Sometimes you can see http://www.xxx.com/url.php? Url = http://www.baidu.com, then jump to Baidu.
How can I use php to redirect this url?
Only a few simple lines of code can be implemented.
| The code is as follows: |
Copy code |
|
<? Php
$ Url = $ _ GET ["url"];
Header ("Location:". $ url );
?> |
PHP 301 redirection implementation code
| The code is as follows: |
Copy code |
|
<? Php
$ Url = ""];
Header ("HTTP/1.1 301 Moved Permanently ");
Header ("Location: $ url ");
?> |
View status code in ff
It's easy. Use the small software curl for testing.
# Curl-I
HTTP/1.0 301 Moved Permanently
Date: Tue, 06 May 2008 06:27:39 GMT
Server: apache
Location:
See the above HTTP/1.0 301 Moved Permanently