IIS8 How to install and use the URL rewriting tool-url Rewrite

Source: Internet
Author: User

Download and install the URL Rewrite

IIS8 The URL rewriting tool is not installed by default, you must download the installation yourself.

If you have installed the Web Platform Installer by default on IIS, we can use the platform to automatically install the URL rewrite rewrite tool, open IIS (Internet Information Services Manager), locate the management item in the Manager home page, and open the Web Platform installer, such as:

Select the product in the Web Platform Installer server, find the URL rewrite tool in the list, click Add and click Install, you can install it automatically! Such as:

We can also manually download the URL rewrite plugin, which is the official address: URL rewrite download

Here are two ways to download the Web Platform Installer plug-in package for online installation, click on the download page of the install this The extension button downloads the Urlrewrite2.exe installer, and the Web Platform installer installs the URL Rewrite tool 2.0 after double-clicking it automatically.

Another way is to download the offline install package on the page near the bottom of the download URL Rewrite Module 2.0 block. However, to choose the corresponding version of the server, such as the author's server is 64-bit, Chinese Simplified, the version to choose:

There are no complicated steps in either of these ways, basically always click Next until you're done.

2015/10/21 Update, now download links only version of the difference, no language differences, the language will be based on the server automatically judge:

Specific steps for using the URL rewrite tool on IIS

URL Rewrite Rewrite tool is mainly to use regular or wildcard characters to match, for regular and wildcard to have a certain understanding, you can check the relevant information online, here is recommended to see the official Help document: URL Rewrite Module Configuration and IIS URL Rewrite module

First open the URL rewriting feature of the Web site under IIS:

We can see that there are many rule templates available by default by selecting Add Rule in the Action menu bar on the right or right, where we select a blank rule as a rewrite to add 301 redirects:

When we open the interface for editing inbound rules, we enter our own defined names, choose how to match URLs and the rules used, and rules can choose regular expressions, wildcards, and exact matches, using the regular as an example. Finally in the match URL pattern input. * (regular expression that matches all paths, this is the rule patterns in the document).

Here's a look at the rule pattern here: A detailed description of the matching url-rule pattern for the URL rewriting tool in IIS (rule patterns)

Next add the URL filter, logical grouping that according to their own needs to choose, such as the author is going to do the whole station 301 jump, so here with any match. Click the Add button, set the input to {http_host}, the type to match the pattern, the mode is ^www.shiyousan.com$, since the use of regular as the matching rule was selected, so be careful to use the correct matching rules. Here is mainly set to match all the two-level domain name path with WWW, regardless of whether there are parameters or the directory will all match to, equal to two-level domain name full station matching for redirect jumps.

Ps:

    1. The server variable is not set if it is not emptied.
    2. The {http_host} server variable type, which represents the requested host, is the value entered by the rule condition. If the selected type matches the pattern, it is commonly used query_string, Http_host, Server_port, Server_port_secure, Request_uri and other service variables. It is recommended that you look at this article: a detailed description of the rule conditions for the URL rewriting tool in IIS.

The final step is to set the action with five options for the action type: rewrite, none, redirect, custom response, abort request. The author chooses to redirect and then sets the redirect URL, where the URL is: http://shiyousan.com/{r:0}. All www.shiyousan.com URLs (including addresses with parameters and multi-level directories) are redirected to the URL of shiyousan.com, the top-level domain name. Last redirect Type Select Permanent 301 and you're done!!!

PS:{R:0} is a reverse reference that represents a match to the URL pattern. * The regular all match, that is, the rule patterns matching rules, specifically, you can see this article: detailed in the URL rewriting tool in IIS about the operation redirect URL {r:n} and {c:n}, You can also look at the official documentation: Using back-references in rewrite rules

IIS8 How to install and use the URL rewriting tool-url Rewrite

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.