Welcome to the Linux community forum and interact with 2 million technical staff. Use php to redirect website 301 to another domain name: What is 301 redirection? 301 redirection (also called 301 redirection, 301 redirection) is the status of the header information in the HTTP data stream returned by the server when a user or search engine sends a browser request to the website server.
Welcome to the Linux community forum and interact with 2 million technical staff> go to php to redirect the website to another domain name in full site 301: What is 301 redirection? 301 redirection (also called 301 redirection, 301 redirection) is the status of the header information in the HTTP data stream returned by the server when a user or search engine sends a browser request to the website server.
Welcome to the Linux community forum and interact with 2 million technicians>
Use php to redirect the website to another domain name in full site 301:
What is 301 redirection?
301 redirection (also called 301 redirection, 301 redirection) is the header information in the HTTP data stream returned by the server when a user or search engine sends a browser request to the website server) indicates that the webpage is permanently transferred to another address.
Other common status codes also include 200 indicating that everything is normal, 404 webpages cannot be found, 302 temporarily switched, 500 internal request errors, and so on.
Website redirection method:
Website redirection methods include 301 redirection, 302 redirection, JavaScript redirection, PHP/ASP/CGI redirection, META. REFRESH, and meta refresh. 302 redirection may cause URL Normalization Problems. Other methods are commonly used *****. Of course, this is not to say that they cannot be used locally. the method itself is correct, but it is used more, search engines are sensitive to these suspicious turns. Why take risks.
301 necessity of turning
When webpage A is redirected to webpage B with 301, the search engine can be sure that webpage A changes its position permanently or does not actually exist. Then, the search engine regards webpage B as the only valid target. The advantage is that,
First, there is no URL standardization Problem
Second, it is also very important that the PR level of Web Page A will be uploaded to web page B.
Third, the domain name will not change.
Implementation
$ Url = "phpzixue.cn". $ _ SERVER ["REQUEST_URI"];
Header ("HTTP/1.1 301 Moved Permanently ");
Header ("Location: $ url ");
?>
The above code is the 301 jump function to be implemented. You only need to place the above Code in the header of the page you want to jump to. Note: No output is available before the above Code.
Test:
Use the small software curl for testing.
# Curl-I bbbb.com/index.php
HTTP/1.0 301 Moved Permanently
Date: Tue, 06 May 2008 06:27:39 GMT
Server: apache
Location: phpzixue.cn/index.php
If you see the above HTTP/1.0 301 Moved Permanently, it means you can. The next time you click the relevant link, the new link will be automatically switched to the new link, and the search engine will automatically update the new link.