A few days ago, I changed the website space and found that the original URL rewriting was no longer valid. The original use was the pseudo-static implemented by urlRewriter, for URL rewriting in IIS6, you can refer to using URLRewriter. dll to implement url redirection. Through communication with customer service, we realized that in IIS7, we no longer need to install other components. By simply configuring web. config, we can implement pseudo-static URLs. The method is as follows:
Add the following code to the configuration node of the web. config configuration file:
<System. webServer>
<Rewrite>
<Rules>
<Rule name = "rulename">
<Match url = "newurl" ignoreCase = "false"/>
<Action type = "Rewrite" url = "oriurl" appendQueryString = "false"/>
</Rule>
</Rules>
</Rewrite>
</System. webServer>
Here are the URL rewriting rules for this site, which are clear to everyone: the rule node is each rewrite rule, the match node is a pseudo-static rule, and the ignoreCase is case-insensitive; action is the response URL, that is, the real URL; appendQueryString is the parameter or not. When adding multiple rule, note that the name should be different.
<Rewrite>
<Rules>
<Rule name = "rule1">
<Match url = "articles/(\ S +) \. html" ignoreCase = "true"/>
<Action type = "Rewrite" url = "articles/Default. aspx? SubClass = {R: 1} "appendQueryString =" true "/>
</Rule>
</Rules>
</Rewrite>
It can be seen that in IIS6, if the parameter is followed, $ is used, and {R: Number} is used in IIS7 instead of $. Do not forget to use & amp; replace & symbol for multiple parameters
From Tang ye's technical Garden