Web.config重定向到http://www.example.com到https://example.com

编程入门 行业动态 更新时间:2024-10-23 16:23:59
本文介绍了Web.config重定向到www.example到example的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想重定向 www.example , example 或 https:// www。 example example 。如何使用web.config文件执行此操作?

I want to redirect www.example, example or www.example to example. How do I do this with a web.config file?

推荐答案

安装URL重写模块(默认情况下不安装) )。 www.iis/downloads/microsoft/url-rewrite

Install the URL Rewrite module (it doesn't install by default). www.iis/downloads/microsoft/url-rewrite

完成后,您可以在system.webServer / rewrite / rules下的web.config中设置规则部分。添加此规则:

Once you have that, you can set up a rules section in your web.config under system.webServer/rewrite/rules. Add this rule:

<rule name="Redirect www to domain" stopProcessing="true"> <match url="(.*)" /> <conditions logicalGrouping="MatchAny" trackAllCaptures="false"> <add input="{HTTPS}" pattern="^OFF$" /> <add input="{HTTP_HOST}" pattern="^www.example" /> </conditions> <action type="Redirect" url="example/{R:1}" /> </rule>

更多推荐

Web.config重定向到http://www.example.com到https://example.com

本文发布于:2023-11-01 11:40:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1549245.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重定向   config   Web   https   www

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!