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