IIS 301 redirects to the domain name at the beginning of www

  
                  

Understand what is the permanent redirection of resources. Under the simple understanding, when you enter sina.com.cn (Sina Homepage) in the browser, the URL is not changed to www.sina.com.cn. ? Let's say that some 163.com and qq.com will become www.xxx.com and other styles, using permanent redirects of resources, but they are not using IIS.

First, explain what is the permanent redirection of resources. Under the simple understanding, when you enter sina.com.cn (Sina Homepage) in the browser, the URL is not changed. Www.sina.com.cn? Let's say that some 163.com and qq.com will become www.xxx.com and other styles, using permanent redirects of resources, but they are not using IIS. Here is just a way to use the parameters of permanent redirection in IIS. The following will talk about the use of redirects in IIS6.0.
Premise hypothesis, in order to simplify the input here assume two URLs: AA-represents 45it.com, BB-represents www.45it.com
First, how to set up the redirect method?
1. Open IIS Manager;
2. Expand "Website", then select a website, right click and select "Properties", then click on the "Home Directory" tab;
3. In the "Home Directory In the tab you will see "The content of this resource comes from:" and then there are 3 options, which are:
"Directory (D) on this computer";
"On another computer Share (S)";
"Redirect to URL (U)"
4. Select "Redirect to URL (U)", the following options will follow the change
will appear "redirect to ( C):" input box, here is the place to enter the resource redirect URL.
Second, the example shows the method of redirection
1. Target: redirect AA to BB
2. Method: set the host header of AA and BB in IIS, according to the description of "one" The method is to "redirect to URL (U)" in AA and enter the URL of BB, then select "Exact URL entered above" and "Permanent redirection of resources" (preferably select, otherwise the search engine will think You are cheating, the HTTP return value will be correctly responded to 301), so you can complete the AA redirect to BB.
3. Test: Enter AA in the browser, see if it becomes BB?
Third, how to redirect AA with parameters to BB
If you follow the method in "two" test http://45it.com/index.shtml?id=1&host=www.xpcolor.com this At the time of the URL, the browser will visit www.45it.com, the latter parameters will not be redirected, so how to redirect with parameters? Keep looking down
1. Goal: redirect http://45it.com/index.shtml?id=1&host=www.xpcolor.com to http://www.45it.com/index .shtml?id=1&host=www.xpcolor.com
2. Method: At this time, you need to enter the parameters in "Redirect to URL (U)". The input parameters are summarized at the end of this article, in the input box. Enter http://www.45it.com$S$Q
3. Test: Enter http://45it.com/index.shtml?id=1&host=www.xpcolor.com again at this time. When you see if it is correct, you are redirected to http://www.45it.com/index.shtml?id=1&host=www.xpcolor.com?
Fourth, the parameters of the redirect
$ S - pass the suffix of the requested URL to the new URL. The suffix is ​​the portion of the initial URL that is retained after the redirected URL is replaced. If the EXACT_DESTINATION flag is not set, the result destination URL will have the name of the requested file (as the folder name) and the file name itself.
$P- Pass the parameters in the initial URL (such as the querystring parameter) to the new URL, excluding the question mark (?).
$Q- Pass the parameters in the initial URL (such as the querystring parameter) to the new URL, including the question mark (?).
$V-pass the URL of the request, excluding the server name and any parameters. To include parameters, use the $P or $Q variable and the $V variable. If the EXACT_DESTINATION flag is not set, the result destination URL will have the name of the requested file (as the folder name) and the file name itself. There are a lot of parameters, basically the most commonly used are $S and $Q, any URL wants to achieve 301 permanent redirection just set $S and $Q.

Copyright © Windows knowledge All Rights Reserved