PHP Implementation 301 Steering Code

Source: Internet
Author: User
Tags curl php code

  301 Steering Definition
301 Turn (or 301 redirect, 301 jump) is one of the status codes in the header information (header) in the HTTP data stream returned by the server when the user or search engine sends a browse request to the Web server. Indicates that this page is permanently transferred to another address.
Other common status codes also include, 200 means all normal, 404 Web pages are not found, 302 temporary turn, and so on.
Web site to do the method of steering
Web site steering methods mainly include: 301 turn, 302 turn, JavaScript turn, php/asp/cgi turn, meta-refresh page meta Refresh, etc. The 302 steering may have URL normalization issues. Other methods are commonly used cheating, of course, not to say that can not be properly used, the method itself is not wrong, but the cheater used more, the search engine for these suspicious turn are very sensitive. Why take the risk?
301 The necessity of steering
When page A is redirected to page B with 301 redirects, the search engine can be sure that page a permanently changes location, or that it doesn't actually exist, and that the search engine will use page B as the only effective target. The advantage is that
First, no URL normalization issues
Second, also very important, page A's PR page level will be uploaded to the page B
Third, not because the domain name replacement does not.
Implement
CODE:
<?php
$url = ""];
Header ("http/1.1 moved Permanently");
Header ("Location: $url");

Like the PHP code on the diagram above. You can implement this function. Where is the code to put it? We take Discuz6.0 as an example
index.php
archiver/index.php
forumdisplay.php
viewthread.php
space.php
tag.php
blog.php
finds the previous file in the old domain name and adds the above code. The update is good.
Testing
is easy. To test, use the Curl software to check.
#curl-i 
http/1.0 Moved Permanently
Date:tue, May 2008 06:27: GMT
Server:apache
Location:&nbsP

If you see the http/1.0-Moved permanently above, it's OK. The next time a link is linked, it will automatically turn to a new link, and the search engine will automatically update to the new link

Related Article

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.