码迷,mamicode.com
首页 > Web开发 > 详细

IIS 7.5伪静态文件web.config编写规则及301重定向方法

时间:2018-01-17 15:54:38      阅读:306      评论:0      收藏:0      [点我收藏+]

标签:conf   redirect   odi   ref   index.php   system   通过   .com   ^c   

实现普通页面、带一个数字参数页面和带两个参数页面的伪静态!

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>

<rule name="Index" stopProcessing="true">
<match url="^index.html" />
<action type="Rewrite" url="index.php" />
</rule>

<rule name="Rule1" stopProcessing="true">
<match url="^news_([0-9]+).html" />
<action type="Rewrite" url="news.php?nid={R:1}" />
</rule>

<rule name="Rule2" stopProcessing="true">
<match url="newslist([0-9]+)_([0-9]+).html" />
<action type="Rewrite" url="news_list.php?nid={R:1}&page={R:2}" />
</rule>

</rules>
</rewrite>
</system.webServer>
</configuration>

IIS 7.5通过web.config实现301重定向的方法,将不带www的域名转向到带www的域名上!

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>

<rule name="Redirect" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^chuangluo.com$" />
</conditions>
<action type="Redirect" url="http://www.chuangluo.com/{R:0}" redirectType="Permanent" />
</rule>

</rules>
</rewrite>
</system.webServer>
</configuration>

IIS 7.5伪静态文件web.config编写规则及301重定向方法

标签:conf   redirect   odi   ref   index.php   system   通过   .com   ^c   

原文地址:http://blog.51cto.com/11403002/2062074

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!