5680.net

如何配置偽靜態服務器
發表日期:2012-05-24  文章編輯:銀平通

web.conf配置文件的格式
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="ShowProduct/([0-9]*).html" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="Host:" pattern="www.chinafu.com" ignoreCase="false" />
</conditions>
<action type="Rewrite" url="/view.asp?id={R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

配置web.config文件由其它規則導入時要調整的地方:
1、match語句最前面不需要加“/”如:
<match url="/ShowProduct/([0-9]*).html" ignoreCase="false" />
修改為:
<match url="ShowProduct/([0-9]*).html" ignoreCase="false" />(注:去掉了最前面“/”)

2、action語句內不要使用轉義符號。如:
<action type="Rewrite" url="/view.asp?id={R:1}" />
修改為:
<action type="Rewrite" url="/view.asp?id={R:1}" />(注:去掉了“.”與“?”的轉義符號)

文章標簽:http://m.pawlnq.com/pawnqabout/3261.html
文章引用:http://m.pawlnq.com/pawnqabout/3261.html