First, install HTTP redirection
This feature is installed on the "Internet Information Services" \ "World Wide Web Services" \ "Common HTTP Features" \ "http redirection" check in the Install/uninstall open and close Windows feature.
Second, redirect parameter setting description
IIS 301 Redirection Settings
By setting up IIS redirection this time, it is still more convenient. Let's talk about the IIS redirection method, because the site revision is directory-oriented migration, so you have to understand the following Microsoft's IIS directive parameters:
When we set the URL redirection, we can use the URL with the Parameter form, because after all, often face the URL is a lot, if just so one or two page 301 redirect arbitrarily how the whole can be.
Parameter 1: $S--Pass the suffix of the URL to the new URL;
Parameter 2: $P-Pass the query parameter in the URL to the new URL, excluding the question mark (?)
Parameter 3: $Q-Pass the query parameter in the URL to the new URL, including the question mark (?), so when you set the URL address, don't take a question mark, such as:
REDIRECT http://www.jb51.net/catalog.asp?cate=os&page=1 to Http://www.jb51.net/category.php?cate=1&page=1
Just set the catelog.asp file settings in IIS to redirect to Category.php$q.
Parameter 4: $V-the URL of the delivery request, but does not include the server name and any parameters.
There is also the use of wildcard redirection, where it is not commonly used for temporary explanation.
Because we redirect multiple directories, if a single go to set different directed files, then IIS set up will be very cumbersome, but if you are directed to a file and then redirect, and because $_server[' http_referer ' will not be able to take the corresponding reference page, the result is empty, So we have to use the above parameters to pass, this time only need to add a parameter to solve the reference page transfer problem, such as/301.php?go= $V, so you can directly in the php file URL 301 redirect Jump processing.
Redirection Reference (IIS 6.0)
Redirecting a client request is a way to ensure that the user gets the correct page, which applies to situations where the site is under construction or has changed its identity. You can redirect client requests to a directory on the same WEB server, or redirect to another URL.
Configure URL and wildcard redirection
Redirection to URLs and wildcard redirection can be configured programmatically. Use redirection variables and flags to specify targets and behaviors by changing the HttpRedirect metabase properties.
The following example shows the format of a simple redirect string.
Http://destinationurl[,flag[s]]
Where destinationurl can include the following redirection variables to pass the relevant parts of the initial URL to the destination URL. Multiple variables can be used in a single redirect string.
Variable |
Describe |
Example |
$S |
The suffix of the requested URL is passed to the new URL. The suffix is the portion of the initial URL that is reserved after the redirected URL is replaced. If the exact_destination flag is not set, the name of the resulting destination URL will have the name of the requested file (as a folder name) and the file name itself. |
If the virtual directory is mapped to the following Web site: Http://fabrikam/Scripts Configure the redirect to the following exact URL: Http://fabrikam/newscripts$s A new request to the following URL: Http://fabrikam/Scripts/Program.exe will automatically redirect to the following URL: Http://fabrikam/NewScripts/Program.exe |
$P |
Passes the parameters in the initial URL (such as the QueryString parameter) to the new URL, excluding the question mark (?). |
If the virtual directory is mapped to the following Web site: Http://fabrikam/Scripts Configure redirection to the following URL: Http://fabrikam/newscripts$p A new request to the following URL: Http://fabrikam/Scripts/File.asp?var1=5&var2=6 will automatically redirect to the following URL: Http://fabrikam/NewScriptsvar1=5&var2=6 |
$Q |
Pass the parameters in the initial URL (such as the QueryString parameter) to the new URL, including the question mark (?). |
If the virtual directory is mapped to the following Web site: Http://fabrikam/Scripts Configure the redirect to the following exact URL: Http://fabrikam/newscripts$s$q A new request to the following URL: Http://fabrikam/Scripts/File.asp?var1=5&var2=6 will automatically redirect to the following URL: Http://fabrikam/NewScripts/File.asp?var1=5&var2=6 |
$V |
The URL of the delivery request, excluding the server name and any parameters. To include parameters, you can use $P or $Q variables and $V variables. If the exact_destination flag is not set, the name of the resulting destination URL will have the name of the requested file (as a folder name) and the file name itself. |
If the virtual directory is mapped to the following Web site: Http://fabrikam/Scripts Configure the redirect to the following exact URL: Http://contoso$v A new request to the following URL: Http://fabrikam/Scripts/File.asp will automatically redirect to the following URL: Http://contoso/Scripts/File.asp |
Using wildcard redirection
You can use the redirect wildcard character to match any number of characters in the original URL. The destination URL is marked with an asterisk (*) and a semicolon (;) Begins with a semicolon-delimited list of paired wildcards and destination URLs. The following example shows the format of a redirection string that uses wildcards.
*; Wildcard1; destination1[; Wildcard2; destination2][, Flags]
Where Wildcardn can include an asterisk (*) to match any number of characters in the initial URL, and pass these characters to destinationn using the variables defined in the following table ($ to $9).
Variable |
Describe |
Example |
From $ $9 |
Passes the portion of the requested URL that matches the specified wildcard character. For each wildcard;destination set, the wildcard character must start at $ A. The redirect string must be appended with the EXACT_DESTINATION flag. |
If the virtual directory is mapped to the following Web site: Http://fabrikam/Scripts Configure using the following redirection string: *; /scripts/*_in.asp; /newscripts/$0.dll; /scripts/*_out.asp; Http://contoso/newscripts/$0.dll A new request to the following URL: Http://fabrikam/Scripts/data_in.asp Http://fabrikam/Scripts/data_out.asp will automatically redirect to the following URL, respectively: Http://fabrikam/NewScripts/data.dll Http://contoso/NewScripts/data.dll |
! |
Redirection is not allowed. You can use this variable if you want to make the file or subdirectory non-redirected when the parent directory is configured for redirection. |
If the virtual directory is mapped to the following Web site: Http://fabrikam/Scripts Configure the redirect to a location other than the following Web site: Http://fabrikam/Scripts/Commerce/Accounts You must exempt redirection to programmatically set the redirect string for the Exempt folder to: *;! |
For example, to redirect all requests for/scripts/filename.stm to a file named Default.stm and redirect all requests for/scripts/filename.htm to the Default.htm file, use the/scripts The virtual directory uses the following redirection requests:
*; Filename.stm;/default.stm/filename.htm;/default.htm
Using redirection Flags
The following flags are used to augment the URL or wildcard format redirection string. Multiple flags are allowed. The flags are programmatically appended to the redirection string in HttpRedirect, or configured by selecting the check box in IIS Manager.
Sign |
User interface check box |
Describe |
Exact_destination |
The exact URL entered above |
Indicates that the value provided for Destination should be treated as an absolute target location. |
Child_only |
The directory below the directory |
Notifies IIS that a redirect should occur only once, because the destination location is a subdirectory of the initial URL. This flag avoids the loop. Also, this flag instructs IIS to redirect the request only if the request is a subfolder or file that is redirected to the initial URL. |
PERMANENT |
Permanent redirection of resources |
Indicates that the resource is permanently redirected. |
Temporary |
Clear the Permanent redirection of resources check box |
Represents a temporary redirection of the resource. |
Overview: Implement the overall site 301 jump, set IIS site properties home directory redirect to URL write http://www.newdomain.com$s$q and select the exact URL entered above and permanent redirection of the resource. The URL parameters of the old domain can be passed to the new domain name completely.
IIS http redirection configuration, parameter settings