如何在iis7.0中配置偽靜態(tài)
作者:佚名 時間: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文件由其它規(guī)則導入時要調(diào)整的地方:
1、match語句最前面不需要加“/”如:
<match url="/showproduct/([0-9]*).html"/>
修改為:
<match url="showproduct/([0-9]*).html"/>(注:去掉了最前面“/”)
2、action語句內(nèi)不要使用轉(zhuǎn)義符號。如:
<action type="rewrite" url="/view\.asp\?id={r:1}" />
修改為:
<action type="rewrite" url="/view.asp?id={r:1}" />(注:去掉了“.”與“?”的轉(zhuǎn)義符號)