现在的位置: 首页 > 综合 > 正文

IIS7.0中伪静态配置说明

2011年01月29日 ⁄ 综合 ⁄ 共 673字 ⁄ 字号 评论关闭

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}" />(注:去掉了“.”与“?”的转义符号)

抱歉!评论已关闭.