Windows IIS7 伪静态 web.config 配置方法
来源:互联网 发布:卡五星源码 编辑:程序博客网 时间:2024/06/05 00:08
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>
<!--301重定向把不带3W的域名 定向到带3W-->
<rule name="Redirect" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^yisinuo.net$" />
</conditions>
<action type="Redirect" url="http://www.yisinuo.net/{R:0}" redirectType="Permanent" />
</rule>
<!--首页-->
<rule name="rD">
<match url="^$" />
<action type="Rewrite" url="Default.aspx" />
</rule>
<!--产品列表-->
<rule name="rP">
<match url="^product/$" />
<action type="Rewrite" url="ProductList.aspx" />
</rule>
<!--产品列表第几页-->
<rule name="rPL">
<match url="^product/list-([0-9]*).html$" />
<action type="Rewrite" url="ProductList.aspx?page={R:1}" />
</rule>
<!--产品类别列表-->
<rule name="rPT">
<match url="^product/([A-Za-z0-9-]*)/$" />
<action type="Rewrite" url="ProductList.aspx?typeUrl={R:1}" />
</rule>
<!--产品类别列表第几页-->
<rule name="rPTL2">
<match url="^product/([A-Za-z0-9-]*)/list-([0-9]*).html$" />
<action type="Rewrite" url="ProductList.aspx?typeUrl={R:1}&page={R:2}" />
</rule>
<!--产品详细-->
<rule name="rPd">
<match url="^product/([A-Za-z0-9-]*)/([A-Za-z0-9-]+).html$" />
<action type="Rewrite" url="ProductDetail.aspx?typeUrl={R:1}&url={R:2}" />
</rule>
</rules>
</rewrite>
</system.webServer>
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>
<!--301重定向把不带3W的域名 定向到带3W-->
<rule name="Redirect" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^yisinuo.net$" />
</conditions>
<action type="Redirect" url="http://www.yisinuo.net/{R:0}" redirectType="Permanent" />
</rule>
<!--首页-->
<rule name="rD">
<match url="^$" />
<action type="Rewrite" url="Default.aspx" />
</rule>
<!--产品列表-->
<rule name="rP">
<match url="^product/$" />
<action type="Rewrite" url="ProductList.aspx" />
</rule>
<!--产品列表第几页-->
<rule name="rPL">
<match url="^product/list-([0-9]*).html$" />
<action type="Rewrite" url="ProductList.aspx?page={R:1}" />
</rule>
<!--产品类别列表-->
<rule name="rPT">
<match url="^product/([A-Za-z0-9-]*)/$" />
<action type="Rewrite" url="ProductList.aspx?typeUrl={R:1}" />
</rule>
<!--产品类别列表第几页-->
<rule name="rPTL2">
<match url="^product/([A-Za-z0-9-]*)/list-([0-9]*).html$" />
<action type="Rewrite" url="ProductList.aspx?typeUrl={R:1}&page={R:2}" />
</rule>
<!--产品详细-->
<rule name="rPd">
<match url="^product/([A-Za-z0-9-]*)/([A-Za-z0-9-]+).html$" />
<action type="Rewrite" url="ProductDetail.aspx?typeUrl={R:1}&url={R:2}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
转载自彦贞的博客(http://www.cnblogs.com/yanzhen/archive/2012/01/07/iis7-wei-jing-tai.html)
阅读全文
0 0
- Windows IIS7 伪静态 web.config 配置方法
- IIS7 伪静态 web.config 配置方法
- IIS7 伪静态 web.config 配置方法
- IIS7 伪静态 web.config 配置方法
- IIS7 伪静态 web.config 配置方法【详解】
- IIS7 伪静态 web.config 配置方法【详解】
- IIS7伪静态web.config配置的方法和规则
- IIS7.5使用web.config设置伪静态的二种方法
- 伪静态IIS7配置
- IIS7.5(IIS7)配置伪静态urlrewrite
- win7 IIS7.5配置伪静态2中方法
- web.config iis7.5 配置
- 关于urlrewritingnet实现伪静态在web.config中的配置
- IIS7.0 + Aspnet 配置伪静态问题....
- IIS7.0中伪静态配置说明
- win7 IIS7.5配置伪静态
- win7 IIS7.5/7.0 配置伪静态
- win10+iis7.5 配置伪静态
- leetcode--Maximum Depth of Binary Tree
- ARM之串口操作
- 使用BS4解析网页内容 并获取指定内容
- ES6之块级作用域
- 30分钟学会如何使用Shiro
- Windows IIS7 伪静态 web.config 配置方法
- oracle数据库创建用户和表空间
- java从字符串中提取数字
- 欢迎使用CSDN-markdown编辑器
- Qt函数库之QScrollBar类参考
- Git中.gitignore文件不起作用的解决以及Git中的忽略规则介绍
- ARM之按键中断
- 虚拟现实的发展历程
- 学习笔记【8月8日】