Below we have summarized several methods of page Jump in php. To achieve page Jump in php, we need to use the header function. Below I will introduce all of my friends who need it for reference.
The simplest is to use php header to implement
The code is:
| The Code is as follows: |
Copy code |
<? Php Header ("Location: http://www.bKjia. c0m /"); ?> 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