IIS 7 重定向到新域
早上好,
我正在尝试在 IIS 中创建重写规则以将特定页面重定向到新的 url,但是当我应用该规则时没有发生重定向,我错过了什么?代码:
</rule>
<rule name="Redirect" enabled="false" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{URL}" pattern="^(/)?$" />
<add input="{HTTP_HOST}" pattern="domain1/server/sdk/" />
</conditions>
<action type="Redirect" url="https://domain2/rest/" />
</rule>
Good morning,
I am trying to create a Rewrite rule in IIS to redirect a specific page to a new url however when I apply the rule no redirect happens what am I missing? Code:
</rule>
<rule name="Redirect" enabled="false" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{URL}" pattern="^(/)?quot; />
<add input="{HTTP_HOST}" pattern="domain1/server/sdk/" />
</conditions>
<action type="Redirect" url="https://domain2/rest/" />
</rule>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试将 REQUEST_URI 添加到模式匹配
匹配网址也可能效果更好,
同时确保规则已启用,您的版本上有
enabled="false"
这是我的完整规则
Try adding REQUEST_URI to the pattern match
match url may also work better as
also make sure the rule is enabled, your version has
enabled="false"
on itHere is my full rule
非常好,非常感谢迈克,我在测试后确实禁用了我的规则,但它不起作用,这就是为什么它显示启用= false,但是我根据你的建议修改了规则,这对我有用!如果这对将来的其他人有帮助,我的完整规则是:
Excellent thank you very much Mike, I did disable my rule after testing it and it did not work which is why it shows enabled=false however I revised the rule per your advice and that worked for me! Incase this is helpful for anyone else in the future my full rule is: