asp.net IIS URL重定向 设置

asp.net IIS URL重定向 设置,先到微软官网下载URL Rewrite

https://www.iis.net/downloads/microsoft/url-rewrite

根据自己服务的版本,下载对应的URL Rewrite 安装包,Chinese Simplified: x86 installer / x64 installer

本人在安装后,查看网站信息中,并不没有看到 URL Rewrite 这个模块,一度怀疑自己装错了,然后网上说要先停止IIS服务器管理器,不是停止网站或服务器,要把IIS管理器先关掉这样才行,然后再安装URL Rewrites安装包,果然有效。

下面就可以直接配制URL重新规则 ,下面是将域名重定向操作示例,

<configuration>

<system.web>

<compilation targetFramework="4.0" />

<customErrors mode="Off" />

</system.web>

<system.webServer>

<rewrite>

<rules>

<rule name="301Redirect" stopProcessing="true">

<match url="(.*)" />

<conditions logicalGrouping="MatchAll">

<add input="{HTTP_HOST}" pattern="^abc.com$" />

</conditions>

<action type="Redirect" url="http://www.abc.com/{R:0}" redirectType="Permanent" />

</rule>

<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>

</rules>

</rewrite>

</system.webServer>

</configuration>

批量修改文件名 2024年最新版 完全免费
批量修改文件名称、文件夹名称

方便快捷,支持正则表达式、无需安装功能齐全、支持定制无广告、无插件,放心使用。

免费下载 百度网盘
本站中所有的计算器的计算结果仅供参考,本站对此结果的准确性不承担任何责任,实际数额以银行/保险公司/国家相关机构确认的结果为准。
在线客服QQ:543690914,备案号: 苏ICP备15037649号-33。东海县白塔埠镇佳诚电脑经营部版权所有。