zoukankan      html  css  js  c++  java
  • IIS中使用URL重写工具进行rewrite的规则示例

    web.config中system.webServer节点添加重写规则

    <rewrite>
    <rules>

    重写规则

    </rules>
    </rewrite>

    HTTP 重定向到 HTTPS
    <rule name="HTTP to HTTPS redirect" stopProcessing="true">
      <match url="(.*)" />
      <conditions>
      <add input="{HTTPS}" pattern="off" ignoreCase="true" />
      </conditions>
      <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
    </rule>

    重定向到带www的域名
    <rule name="www redirect" stopProcessing="true">
      <match url=".*" />
      <conditions>
      <add input="{HTTP_HOST}" pattern="^baidu.com$" />
      </conditions>
      <action type="Redirect" url="http://www.baidu.com/{R:0}" redirectType="Permanent" />
    </rule>

    多个域名重定向
    <rule name="WWW Redirect" stopProcessing="true">
      <match url=".*" />
      <conditions>
      <add input="{HTTP_HOST}" pattern="^baidu.com|idc.baidu.com$" />
      </conditions>
      <action type="Redirect" url="http://www.baidu.com/{R:0}" redirectType="Permanent" />
    </rule>

    强制使用小写url
    <rule name="LowerCase" stopProcessing="true">
      <match url="[A-Z]" ignoreCase="false" />
      <action type="Redirect" url="{ToLower:{URL}}" />
    </rule>

    用户友好的url重写,如:index.aspx?t=show&id={id}重写到show_{id}.aspx
    <rule name="show">
      <match url="show_(d+)((.aspx||.html)*)" ignoreCase="false" />
      <action type="Rewrite" url="index.aspx?t=show&id={R:1}" appendQueryString="false" />
    </rule>

  • 相关阅读:
    [洛谷P1886]滑动窗口 (单调队列)(线段树)
    树状数组详细解析
    离散化
    kettle使用总结(一)
    springBoot开发的web项目打war包部署到已有的tomcat容器中
    集群时钟同步
    linux服务器安装nginx
    Tomcat学习之体系架构
    码云新建仓库上传项目
    linux系统安装mysql yum方式
  • 原文地址:https://www.cnblogs.com/doven/p/9699380.html
Copyright © 2011-2022 走看看