How to do 301 permanent redirects

Source: Internet
Author: User

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

301 Permanent Redirect: This is an SEO basic noun, in the URL normalization will use, perhaps we all know this noun, but because the application is not very frequent, cause many professional do SEO friends are not very familiar with the 301 permanent redirection of the specific methods of operation, Today I'm going to explain the theory of 301 permanent redirects, and the practical ways of doing it.

301 Concept of Permanent redirection:

Web site redirection is one of the most feasible approaches. When a user or search engine sends a browse request to a Web server, one of the status codes in the header (header) of the HTTP data stream returned by the server indicates that this page is permanently transferred to another address.

The above paragraph is a brief description of the concept of 301 permanent redirects, so why do you pay so much attention to 301 permanent redirects?

Reason: 301 permanent redirect is the only way to comply with the search engine rules in all redirect methods, the other redirect also includes 302 temporary redirect and JS Jump, and so on, these methods are easy to cause the problem of URL irregularities. So if you have multiple domain names and you want them to have access to the same site, that can only be one of the main domain name, the rest of the other domain to do 301 permanent redirect to the main domain name, only in this way can be perfect for multiple domain names are visited a site, will not produce duplicate collection, resulting in the site was punished phenomenon.

301 method of execution for permanent redirection:

301 permanent redirects have several different practices that differ from the UNIX host on a Windows host.

One, the method set on the Windows host: can be set on the IIS server or can be set in code.

1, set the method of 301 on the IIS server:

This setup requires an innate condition, that is, you have the management of the server, you can directly operate the IIS server, and can open a new virtual host, otherwise you can only modify the site code method.

First open a new virtual host, will you need to do 301 permanent redirect Domain name normal with the space binding, this binding method you can consult the server custodian.

Then open Control Panel → find Administrative tools → open Internet information services. Once open, you can find your site in the left tree menu of the organizer, and then right-click to select Properties. Open the Properties Management panel for the Web site (as shown below) and select to the Home Directory tab, select Redirect to URL, and then enter primary domain name in the Address box, and then permanently redirect resources from the tab "Select, click OK to set up."

  

2, in the site code to set 301 method:

Just add the following code to the beginning of the Web page, but only in ASP and PHP files, HTML currently cannot be set by Code 301.

ASP code:

<%@ Language=vbscript%>
<%
Response.status= "Moved Permanently" Response.AddHeader "Location", "http://www.xueseo.com.cn"
>
PHP:
?
Header ("http/1.1 moved Permanently");
Header ("location:http://www.xueseo.com.cn");
?>

Note: replace my URL with your own targeted URL, all punctuation must be in English half-width.

If you are using a UNIX host: you can use the. htaccess file.

For example, to transfer/old.htm to/new.htm, you can use this command: REDIRECT 301/old.htm/new.htm. If you want to redirect all http://xueseo.com.cn form URLs to http://www.xueseo.com.cn with 301 redirects. Including all the directories and the inner page also to the corresponding location of the new domain name, it is necessary to use the mod_rewrite, the writing format is as follows:

Options +followsymlinks
Rewriteengine on
Rewritecond%{http_host} ^xueseo.com.cn [NC]
Rewriterule ^ (. *) $ http://www.xueseo.com.cn/$1 [l,r=301]

Author: Sun Yunqun
Start: Shandong SEO Training Team
URL: http://www.xueseo.com.cn

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.