Php page Jump implementation program code

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.