Use Microsoft URL rewrite module for IIS 7.0 to modify web. config to implement *. html pseudo-static without modifying application ing

Source: Internet
Author: User

In the iis5 and IIS6 times, we can use URL rewriting to rewrite the URL so that the WebProgramPseudo-static, but can only be implemented by default. aspx pseudo-static, If You Want To implement pseudo-static *. for HTML pages *. change the HTML Application ing.. Net ISAPI. However, in the IIS 7 era, all this has become very simple, and you can manage it in Web. config.

 

Install the Microsoft URL rewrite module on the server as follows:

Microsoft URL rewrite module for IIS 7.0 (x86)

: Http://www.iis.net/downloads/default.aspx? Tabid = 34 & G = 6 & I = 1691

Microsoft URL rewrite module for IIS 7.0 (x64)

: Http://www.iis.net/downloads/default.aspx? Tabid = 34 & G = 6 & I = 1692

 

After installation

 

 

You can directly add Rewrite Rules in IIS 7 or set them in Web. config:

 

<? XML version = "1.0" encoding = "UTF-8" ?>
< Configuration >
< System. Webserver >
< Rewrite >
< Rules >
< Rule Name = "Rewrite to article. aspx" >
< Match URL = "^ Article/(%0-9%%%%%.html $"   />
< Action Type = "Rewrite" URL = "Article. aspx? Newid = {R: 1 }"   />
</ Rule >
</ Rules >
</ Rewrite >
</ System. Webserver >
</ Configuration >

 

Then, access/article/366.html is access/Article. aspx? The result of newid = 366 does not need to add the ISAPI ing of *. html as in the previous IIS 6 era. (This is a good news for websites that use virtual hosts. You don't have to ask the Administrator to add the settings for you. You can set the settings in Web. config)

 

A rewrite rule Conversion Tool is provided below.

You can configure your original third-party components or Apache. htaccess rules, and quickly convert them to iis7.0 using web. config to rewrite rules.

 

 

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.