.net - URL 具有 HTTPS 时的 Web 配置重定向
问题描述
我想尝试从
"https://abcd.net-------------> https://www.abcd.net"
我已经重定向了
"http://abcd.net-------------> http://www.abcd.net"
"http://www.abcd.net-------------> https://www.abcd.net"
<rule name="Force HTTPS" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTPS}" negate="true" pattern="^ON$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" redirectType="Permanent" />
</rule>
需要使用 www 将所有 abcd.net 重定向到 HTTPS
解决方案
根据您的描述,我建议您可以尝试添加一个新的 url 重写规则以匹配“ https://abcd.net ”以重定向到“ https://www.abcd.net ”。
细节,你可以参考下面的重写规则:
<rule name="Redirect https" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTPS}" pattern="^ON$" />
<add input="{HTTP_HOST}" pattern="abcd.net" />
</conditions>
<action type="Redirect" url="https://www.abcd.net/{R:0}" appendQueryString="false" redirectType="Permanent" />
</rule>
<rule name="Force HTTPS" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTPS}" negate="true" pattern="^ON$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" redirectType="Permanent" />
</rule>
推荐阅读
- c++ - 通过for循环获取文件的行数
- python - 在一组“二进制字符串”中计算一个(Python)
- c# - 当单元格在 EPPlus 中具有多种样式时,公式单元格正在提取 xml 样式表值
- android - 通过清单注册的广播接收器是否会在应用关闭时自动取消注册?
- ios - 从 Facebook 点击的 Ionic Cordova 分支深层链接返回 `+clicked_branch_link: false`
- c++ - 包含子元素的元素的数组?
- swift - 使用填充在 Watchkit Map 中拟合注释
- javascript - react js:TypeError:object null is not iterable(无法读取属性Symbol(Symbol.iterator))
- r - 有什么方法可以创建以范围为过渡时间的动画(gganimate)?
- quill - 在 Quilljs 中增加标签的缩进大小