<rule name="Redirect" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^(w1.baidu.com|w2.taobao.com|xyw0001.my3w.com)$" />
</conditions>
<action type="Rewrite" url="down2/{R:0}" />
</rule>
IIS7 做伪静态比较的简单方便
1.程序方面
只需要设置web.config 就可以了。
2.服务器需要安装:URL Rewrite
下载地址:http://www.iis.net/download/URLRewrite
Godaddy 的主机已经安装这个插件。
本地在测试的时候 请查看自己是否安装这个插件。
注意要点
1.参数用“()” 括起来 ,使用 {R:1}来获得参数
2.多个参数中间用 & 分割
3.name切记不能写一样
<?xml version="1.0"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<!--把二级域名(或指定的域名) 转到目录下-->
<rule name="Redirect" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^(w1.baidu.com|w2.taobao.com|xyw0001.my3w.com)$" />
</conditions>
<action type="Rewrite" url="down2/{R:0}" />
</rule>