Implementation method of domain name 301 redirection

Source: Internet
Author: User
Keywords Construction Station Guide
Tags .url basic code directory domain domain name domain names file

Recently my site changed the domain name, in order to search engine friendly, but also for the site's traffic and weight to be inherited, I used the site 301 redirect. But did not have this kind of operation before, so began to feel not to start, so I intend to go to Baidu, Google search some methods. 301 of the articles on the Internet are many, but I read a lot of posts, but found that the basic is uniform, and basically ignore some important details. below to introduce my 301 redirect process, I hope to help.

In order to be able to say more clearly, I still combine their site to introduce it. My original site domain name is, now replaced in order to, because the site is static Web page, so I do not adopt the way of code, because if you want to use the way of code, only 301 redirect home. A static inner page is added to the code, because once you've accessed the static inner page, you've returned a 200 status code.

In addition, I am buying a server that is a tenant of IIS, and can bind subdirectories, but cannot operate the. htaccess file, because the. htaccess file only works on a Linux host that uses Apache with the MoD rewrite module as a Web server. Finally, I'm going to use the method of setting up IIS for 301 redirects. However, users like me who use a rental server or virtual space cannot operate IIS, which is not a problem, and we can contact the space provider to help set it up.

Here's how IIS describes how to do 301 redirects, as well as the details to be noted in the operation (the Internet does not seem to mention it, I also set a few times after the failure to think of).

First to refer to the Internet under the IIS operation method (you can go to Baidu search "IIS 301" has this introduction):

* Open Internet Information Services Manager, right-click on the page or directory you want to redirect

* Select Redirect to URL

* Enter the address of the target page in the dialog box

* Remember, check "permanent Redirection of resources"

* Of course, finally click "Apply".

This method is correct, but it is too simple to introduce, the operation is easily misleading. Because many owners have only one space, if you want to do 301 Redirect, the general two domain names are bound to a space. At first I was also bound and to a space, and then let the technician help me set up, but failed. Now think of the reason for failure, is because of this, although can let success 301 Redirect to, but will continue to carry out 301 Redirect, will cause infinite dead loop. So you can't bind two domains to a directory.

Correct 301 redirect Steps for My site:

1, through IDC customer service that they can help set up IIS for 301 Redirect, and then I purchased their rental server, and has a subdirectory binding function, so I do not need to buy two space.

2, the binding to the main directory, and the, and are all bound to subdirectories (I want to redirect these 3 domain names, said on the internet with WWW and may be considered by the search engine is two stations). subdirectories without adding any files.

3, let the technician help set up the subdirectory of IIS (there are introductions and pictures on the web), in the "redirect to" in the column input$s$q, and then in the "exact URL above" and "resource permanent redirect" two options before the hook, the last point of application, This 301 permanent redirect is done.

Perhaps you will find me after the domain name plus $s$q characters, here to explain:

$S to pass the suffix of the requested URL to the new URL. The suffix is the part of the initial URL that is reserved after the redirected URL is substituted.

If the exact_destination flag is not set, the name of the resulting destination URL will have the name of the requested file (as the folder name) and the file name itself.

$Q the parameters in the initial URL, such as the QueryString parameter, are passed to the new URL, including the question mark (?). )。

If you do not add the above characters, the internal page 301 will jump to the first page, plus the above characters is the purpose of the page can also accurately jump to the corresponding page of the new domain.

This can achieve the total station of 301 redirects, not only the first page jump. After we finish, we have to check if we are doing the right thing. Open Http:// Direct jump to the Http://,ok, indicating success.

Use the code or modify it on the Internet. Htaccess method I did not try, everyone go to search it, a lot of introductions. Write more long-winded, please forgive me.

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: 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.