当前位置:web 服务器 > IIS >>

WONDOWS2008,IIS7.0伪静态配置规则写法

在web.config配置文件中的configuration节点里加入下面代码:
把重写规则写在rule节点里, match url=伪静态规则,ignoreCase忽略大小写, action type="Rewrite" url=跳转到的页面,appendQueryString是否跟参数
在iis7使用{R:数字}代表参数,比如:
<rule name="Imported Rule 1″>
<match url="news([0-9]+)-([0-9]+).html" ignoreCase="true" />
<action type="Rewrite" url="news.asp?id={R:1}&page={R:2}" appendQueryString="true" />
</rule>
添加多个rule规则要注意name不要重复
iis7中配置301重定向
<rule name="WWW Redirect" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^zhaoxi.org$" />
</conditions>
<action type="Redirect" url="http://www.zhaoxi.org/{R:0}" redirectType="Permanent" />
</rule>
把zhaoxi.org换成你的网址
地址栏输入不带www的网址便会自动跳转到带www的网址
Apache
IIS
Nginx
Tomcat
如果你遇到web 服务器难题:
请访问www.zzzyk.com 试试
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,