需要注意的地方是以前httpd.ini和.htaccess支持网址中两个参数用&符号链接,在web.config中是不支持的,需要将这个符号更改为&才能正常使用。
<?xml version=”1.0″ encoding=”UTF-8″?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name=”Redirect” stopProcessing=”true”>
<match url=”.*” />
<conditions>
<add input=”{HTTP_HOST}” pattern=”^test.com$” />
</conditions>
<action type=”Redirect” url=”http://www.test.com/{R:0}” redirectType=”Permanent” />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
实现普通页面、带一个数字参数页面和带两个参数页面的伪静态!
<?xml version=”1.0″ encoding=”UTF-8″?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name=”Index” stopProcessing=”true”>
<match url=”^index.html” />
<action type=”Rewrite” url=”index.php” />
</rule>
<rule name=”Rule1″ stopProcessing=”true”>
<match url=”^news_([0-9]+).html” />
<action type=”Rewrite” url=”news.php?nid={R:1}” />
</rule>
<rule name=”Rule2″ stopProcessing=”true”>
<match url=”news_list_([0-9]+)_([0-9]+).html” />
<action type=”Rewrite” url=”news_list.php?nid={R:1}&page={R:2}” />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
评论回复