分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 网页技术

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

发布时间:2023-09-06 01:37责任编辑:苏小强关键词:301重定向
实现普通页面、带一个数字参数页面和带两个参数页面的伪静态!

<?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重定向方法

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

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved