IIS7.0中伪静态配置说明

web.conf配置文件的格式

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1">
<match url="ShowProduct/([0-9]*).html"/>
<action type="Rewrite" url="/view.asp?id={R:1}" />
</rule>
<rule name="Imported Rule 2">
<match url="about_([0-9]*).html"/>
<action type="Rewrite" url="/about.asp?id={R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

配置web.config文件由其它规则导入时要调整的地方:

1、match语句最前面不需要加“/”如:
<match url="/ShowProduct/([0-9]*).html"/>
修改为:
<match url="ShowProduct/([0-9]*).html"/>(注:去掉了最前面“/”)

2、action语句内不要使用转义符号。如:
<action type="Rewrite" url="/view\.asp\?id={R:1}" />
修改为:
<action type="Rewrite" url="/view.asp?id={R:1}" />(注:去掉了“.”与“?”的转义符号,“&”符号写成“&amp;”)

posted @ 2013-05-31 10:11  与时俱进  阅读(498)  评论(0编辑  收藏  举报
友情链接:同里老宅院民居客栈