Install and configure IIS7.5 pseudo-static URL Rewrite in Windows 7

Source: Internet
Author: User

Installation:

There seems to be very little introduction to the pseudo-static iis7.5 in Windows 7, generally iis7.0 in Vista, but the difference between iis7.0 and iis7.5 is not great, however, it is a little troublesome for me to directly jump from iis5.1 to iis7.5, and the change from 5.1 to 7.5 is quite big.

The following conditions are required to implement pseudo-static full-site Asp.net Website:
1. iis7.0 (currently, the URL rewrite module only supports iis7 );
2. url rewrite module,: http://www.iis.net/expand/URLRewrite

The following describes the installation of pseudo-static (rewrite) in iis7.5. The installation is silly. Download this component and install it directly.

After the installation is complete, open IIS and you will see the URL rewrite option in the IIS configuration of the website.

 

Double-click the URL rewrite icon (the premise is to select the local test website directory under the "website" directory on the left to use the pseudo-static directory), and then go to the rewrite Management page;
Then we enter the rewrite rule management page;

Click Add Rules to go to The add Rule Page. Of course, the simplest method is to write a *. htaccess rule file locally, and click Import rules to import it.

Case:

A friendly URL address makes it easy for visitors to remember. Ask your users to remember "http://www.pipima.com/article.aspx? The URL id = 342 &; Title = URL-rewrite-walkthrough is not a wonderful thing. If the following URL is provided to the user: Response.
Through the iis url rewrite module, you can easily establish this logic without modifying the rewrite maps code in use. I will tell you how to implement it from the IIS manager. Open the IIS manager, select "Default web site", click "url Rewrite" in "function View", and click "add rules…" in the "operations" column ...", In the "select a rule templates" dialog box, select "Blank rule" to go to the "Edit rule" attribute page and follow the steps below to define the actual rewrite rule (rewrite rule ):
1. Rule name.
2. The pattern used to match the URL string.
3. Set the condition options.
4. operations performed after successful pattern matching and all condition checks.
To implement the following example, the "Edit rule" attribute page is shown in:

The rule name should be unique (not repeated). The matching string "^ article/([0-9] +)/([_ 0-9a-z-] +)" is a regular expression, match any URL string that meets the following criteria:
1. It starts with the "Article/" Character Sequence.
2. "/" contains one or more numeric characters.
3. The second slash (/) contains one or more letters, underscores (_), and hyphens (-).
Because we create a rule that supports URL rewriting, the rule type is "Rewrite". Rewrite the string (rewrite ur) "Article. aspx? Id = {R: 1} & Title = {R: 2} "specifies a new value for entering the URL to be overwritten. We use "{R: 1}" and "{R: 2}" for parameters. They will return a group of references defined by rule matching ). For more information about back reference, see URL rewrite module configuration reference. For more information about creating rewrite rules, see creating Rewrite Rules for the URL rewrite module.
The URL rewrite module must be installed before it can work. You can use the following two versions:
X86 version: http://www.iis.net/downloads/default.aspx? Tabid = 34 &; G = 6 & I = 1691
X64 version: http://www.iis.net/downloads/default.aspx? Tabid = 34 &; G = 6 & I = 1692
This module (currently) only supports iis7.0. You should run iis7.0 to use it. If your project is developed using Visual Studio for Web developers, you should configure the project to run under iis7.0, rather than other Web servers.
For details about the URL rewrite module, see http://learn.iis.net/page.aspx/460/using-url-rewrite-module/

Note:

1. Replace the original $1 with {R: 1}. Other syntaxes are slightly changed. <rewrite url = "~ /Test/([a-zA-Z0-9 _ \-] +)/(\ d1_0000.html \? {0, 1} (. *) $ "to = "~ /Test. aspx? Id = $4 & $5 "Processing =" stop "/>
Change
<Rule name = "orgpage" stopprocessing = "true">
<Match url = "^ test/([a-zA-Z0-9 _ \-] +)/(\ d1_0000.html \? {0, 1} (. *) $ "/>
<Action type = "Rewrite" url = "test. aspx? Id = {R: 1} & {R: 2} "/>
</Rule>
2. url = "~ /Module/", the URL Rewrite Module must be replaced with ^ module/; otherwise, even if the test passes, it cannot be parsed in the actual environment;
3. Previously UrlRewriter url = "^/([a-zA-Z0-9 _] +)" is acceptable, but not in URL Rewrite Module, you must add Parameters
<Conditions logicalGrouping = "MatchAll">
<Add input = "{HTTP_HOST}" pattern = "^ blog \. lehu \. shu \. edu \. cn $"/>
<Add input = "{REQUEST_FILENAME}" matchType = "IsFile" negate = "true"/>
<Add input = "{REQUEST_FILENAME}" matchType = "IsDirectory" negate = "true"/>
</Conditions>
4. in addition, you need to delete applicationHost when converting IIS6 config to iis7. the redundant parameters of In general, IIS7 is more stable than IIS6. Up to now, the buffer pool in IIS6 is rarely found in IIS7. Test is also required.
In addition:
Microsoft URL Rewrite Module:
Http://www.iis.net/downloads/default.aspx? Tabid = 34 & g = 6 & I = 1692
Description of Microsoft URL Rewrite Module Configuration
Http://learn.iis.net/page.aspx/465/url-rewrite-module-configuration-reference/

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.