首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >IIS10URL重定向仅在浏览单个域时失败

IIS10URL重定向仅在浏览单个域时失败
EN

Stack Overflow用户
提问于 2022-10-17 17:55:00
回答 1查看 27关注 0票数 0

我管理两个域,matiasmasso.es和matiasmasso.pt

接下来的规则是在我的Web.Config上设置的,它们对几乎所有的urls都正常工作。

异常情况是当调用http://www.matiasmasso.pt (不使用SSL来命中规则)时,它被错误地重定向到https://www.matiasmasso.es

如果url附加了任何类似于http://www.matiasmasso.pt/test的段,它就不会成功地打开https://www.matiasmasso.pt/test

以下是我的规则:

代码语言:javascript
复制
<rewrite>
  <rules>
      
      <rule name="RedirectToHTTPS" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
              <add input="{HTTPS}" pattern="off" ignoreCase="true" />
          </conditions>
          <action type="Redirect" url="https://{SERVER_NAME}/{R:1}" redirectType="Permanent" />
      </rule>

      <rule name="RedirectNonWwwEsToWww" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
              <add input="{HTTP_HOST}" pattern="^matiasmasso.es$"  ignoreCase="true"/>
          </conditions>
          <action type="Redirect" url="http://www.matiasmasso.es/{R:0}" redirectType="Permanent" />
      </rule>

      <rule name="RedirectNonWwwPtToWww" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
              <add input="{HTTP_HOST}" pattern="^matiasmasso.pt$"  ignoreCase="true"/>
          </conditions>
          <action type="Redirect" url="http://www.matiasmasso.pt/{R:0}" redirectType="Permanent" />
      </rule>
      
  </rules>
</rewrite>

有什么建议吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-10-18 02:33:16

您发布的规则不会导致http://www.matiasmasso.pt重定向到https://www.matiasmasso.es,清除缓存并再次测试。

如果仍然无法解决问题,可以使用请求跟踪失败查看详细请求过程,这将生成详细日志文件,这将帮助您识别问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74101290

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档