我管理两个域,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。
以下是我的规则:
<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>有什么建议吗?
发布于 2022-10-18 02:33:16
您发布的规则不会导致http://www.matiasmasso.pt重定向到https://www.matiasmasso.es,清除缓存并再次测试。
如果仍然无法解决问题,可以使用请求跟踪失败查看详细请求过程,这将生成详细日志文件,这将帮助您识别问题。
https://stackoverflow.com/questions/74101290
复制相似问题