如何在iis7.0中配置伪静态
作者:佚名 时间:2014-10-01
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}" />(注:去掉了“.”与“?”的转义符号)