【发布时间】:2019-02-02 02:03:33
【问题描述】:
我的 URL 重写规则仅适用于 IIS 中的 80 端口。
重写适用于:http://localhost:80 --> http://localhost:8100
重写适用于:http://localhost:80/redirect --> http://localhost:8100
重写不适用于:http://localhost:8080 --> http://localhost:8100
重写不适用于:http://localhost:8080/redirect --> http://localhost:8100
我的 web.config 如下:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="true" showFlags="Date, Time, Size, Extension, LongDate" />
<rewrite>
<rules>
<rule name="Redirect to port 8100" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{SERVER_PORT}" pattern="^8100$" negate="true" />
</conditions>
<action type="Redirect" url="http://{HTTP_HOST}:8100/{R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
web.config 仅适用于默认 http 端口 80/443,但不适用于特定端口。
必须在 web.config 中进行哪些更改才能使用所有端口?
【问题讨论】:
标签: redirect iis web url-rewriting port