【发布时间】:2019-01-24 20:00:51
【问题描述】:
我正在尝试创建一个适当的 web.config 文件来重定向最终用户,以向请求添加端口。
例如,输入http://subscribe.service.com/lists/index.html 的任何最终用户都将被重定向到http://subscribe.service.com:3000/lists/index.html,这样无论调用的请求如何,它都会添加到其中:3000。
下面提供了我正在使用的代码示例。在验证测试中,它似乎可以按我的意愿工作。实际上,当我访问实体网站时,什么都没有发生。
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpRedirect enabled="false" destination="" childOnly="true" httpResponseStatus="Permanent" />
<rewrite>
<rules>
<rule name="3000 Port Redirect" enabled="true" stopProcessing="true">
<match url="http:/(.*)com" />
<conditions>
<add input="{HTTP_HOST}" pattern="\.com(.*)" />
</conditions>
<action type="Redirect" url="{R:0}:3000{C:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
【问题讨论】:
-
你真的需要仔细研究IIS URL Rewrite,blog.lextudio.com/…从错误1开始。
标签: iis module url-rewriting web-config