[英]URL Rewriting help using IIS Rewrite
请帮助我使用IIS重定向URL重写以下内容:
https://domain.com:8080/Context/services/.*
至
https://domain.com:8443/Context/services/.*
我们只有8080端口开放,这就是为什么需要重定向SSL。
但是同时,我不希望重定向任何其他URL,例如https://domain.com:8080/Context/xyz (或除服务之外的任何其他URL)/.*
我尝试了以下操作,但不起作用:
<rule name="HTTPS Request on 8080 Redirect to HTTPS Request on 8443 for Root"
patternSyntax="ECMAScript" stopProcessing="true">
<match url="https(.*)Context/services/.*" />
<conditions>
<add input="{SERVER_PORT}" pattern="8080" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}:8443/{R:0}" />
</rule>
试试看:
<rule name="HTTPS Request on 8080 Redirect to HTTPS Request on 8443 for Root"
patternSyntax="ECMAScript" stopProcessing="true">
<match url="^(Context/services/.*)" ignoreCase="true" />
<conditions>
<add input="{SERVER_PORT}" pattern="8080" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}:8443/{R:0}" />
</rule>
如果您在此处查看“ 访问URL部件”部分 ,您会注意到匹配URL包含放置目录根之后的所有内容。对于根目录中的某些内容(如您的情况),它将包含主机名和端口之后的所有内容没有前导斜杠/。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.