HTTP protocol is a status code, more familiar with the status code is 200, for link OK, there are 404 and 403, one is not found, the other is forbidden. Not found needless to say, may be the address bar entered incorrectly, or the page has been moved. There are many reasons for forbidden, it is possible that IP was pulled into the blacklist of the server, there may be IP over-dense access to the site, is blocked by the site firewall, there may be domain name resolution to the space, but the space is not bound domain name, it is possible that the Web script file in the current directory does not have permission to execute.
All of the above are 2-and 4-word status codes, but the key is the status code of the 3-Word header---301, 302.
First write a php,php content is to specify the use of 301, redirect to Baidu, and then in the browser's address bar to enter the PHP file address, will pop out of the Baidu interface, view its status is 301,
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/7C/E1/wKioL1ba2iSzPafXAAJAr6iIEks473.png "title=" 1.png " alt= "Wkiol1ba2iszpafxaajar6iieks473.png"/>
301 means "Permanent redirect other URLs", 302 means "temporary redirection". Using the 302 method, repeat the above experiment, you will see the status code is 302, and the reply header information will be one more location:www.baidu.com, that is, the destination of the redirect is Baidu this site.
For example, there is a page, is a registered user page, you need to enter the account number, password, mobile phone numbers, e-mail and verification Code of the five information. After the user has entered the above information, the page will have a jump, the prompt "registration success" or "Registration failed", this a few seconds of the jump is also redirected, if successful will be redirected from this brief interface to the official login successful interface, while the user's data will be recorded in the database in the background, Saved to the server.
But you know, in the PHP notation using 301 or 302, if it is still in the above example, the user's information in the redirected interface is not saved, check the return header information will be easy to find, the return header information at the beginning of the post, but to the redirected interface will become get. Get is obtained, nature will not put the information into the database, the user's information input is equal to white write.
For example: Assume that 05.php is the user to write the registration information of the Web page, users fill out all the information, the system redirected to 06.php this page. If this redirect is using 302 or 301, then on 06.php, there is actually no user input information!
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7C/E1/wKioL1ba3GHzFjl9AAQLbk1gFZ8501.png "title=" 1.png " alt= "Wkiol1ba3ghzfjl9aaqlbk1gfz8501.png"/>
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7C/E3/wKiom1ba3gGT7UPhAADZmfVz_6c364.png "title=" 1.png " alt= "Wkiom1ba3ggt7uphaadzmfvz_6c364.png"/>
302 do not try, put 301 erase, the default is 302 method, two methods are the same effect, data loss.
What about this time? Using 307,307 means that the original data remains in the redirect.
In the above figure to change 301 to 307, all problems solved. And you can see, in the 05.php is the post, in 06.php is still post.
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/7C/E3/wKiom1ba3yzx018vAAFpN35O-9A872.png "title=" 1.png " alt= "Wkiom1ba3yzx018vaafpn35o-9a872.png"/>
This article is from "Life is waiting for Gordo" blog, please make sure to keep this source http://chenx1242.blog.51cto.com/10430133/1747923
HTTP protocol 301,302 and 307