通过删除一个部分来修复不正确的 link 到 web.config
fix incorrect link through web.config by removing one section
第 3 方供应商向我们的客户发送电子邮件,其中包含错误的取消订阅 link。在他们可以更新此 URL 之前,我希望通过 web.config.
更正任何请求
正确的 link 应该是:
https://www.example.com/my-account/alertunsubscribe?email=[email]&searchname=[searchname]
电子邮件中损坏的 link 是:
http://www.example.com/property/myaccount/alertunsubscribe?email=[email]&searchname=[searchname]
我一直在尝试使用类似下面的东西:
<rule name="AlertUnsub" stopProcessing="true">
<match url=".*" ignoreCase="true" />
<conditions>
<add input="{HTTP_HOST}" pattern="^property/myaccount/alertsubscribe" />
</conditions>
<action type="Redirect" url="https://www.example.com/my-account/alertsubscribe" appendQueryString="true" />
</rule>
知道我做错了什么吗?我已经有另一个规则将非 http 流量重定向到 https,它工作正常,所以我认为我不必在这里处理它。非 www 到 www 也是如此。
如有任何帮助,我们将不胜感激。
谢谢
您应该查找与 URL 而不是 {HTTP_HOST}
变量的匹配项,因此不需要条件。
试试这个:
<rule name="AlertUnsub" stopProcessing="true">
<match url="^property/myaccount/alertunsubscribe" />
<action type="Redirect" url="my-account/alertunsubscribe" appendQueryString="true" redirectType="Found" />
</rule>
顺便说一句,问题中的 alertsubscribe
和 alertunsubscribe
存在混淆。我假设它是 alertunsubscribe
.
第 3 方供应商向我们的客户发送电子邮件,其中包含错误的取消订阅 link。在他们可以更新此 URL 之前,我希望通过 web.config.
更正任何请求正确的 link 应该是:
https://www.example.com/my-account/alertunsubscribe?email=[email]&searchname=[searchname]
电子邮件中损坏的 link 是:
http://www.example.com/property/myaccount/alertunsubscribe?email=[email]&searchname=[searchname]
我一直在尝试使用类似下面的东西:
<rule name="AlertUnsub" stopProcessing="true">
<match url=".*" ignoreCase="true" />
<conditions>
<add input="{HTTP_HOST}" pattern="^property/myaccount/alertsubscribe" />
</conditions>
<action type="Redirect" url="https://www.example.com/my-account/alertsubscribe" appendQueryString="true" />
</rule>
知道我做错了什么吗?我已经有另一个规则将非 http 流量重定向到 https,它工作正常,所以我认为我不必在这里处理它。非 www 到 www 也是如此。
如有任何帮助,我们将不胜感激。
谢谢
您应该查找与 URL 而不是 {HTTP_HOST}
变量的匹配项,因此不需要条件。
试试这个:
<rule name="AlertUnsub" stopProcessing="true">
<match url="^property/myaccount/alertunsubscribe" />
<action type="Redirect" url="my-account/alertunsubscribe" appendQueryString="true" redirectType="Found" />
</rule>
顺便说一句,问题中的 alertsubscribe
和 alertunsubscribe
存在混淆。我假设它是 alertunsubscribe
.