[英]How to rewrite the request to sub-folder to another application in IIS
if user request to http://my.example.com/pages/uc?dc=qXE7kHEIHHiT2Gexv%2bLDy63yqTeh3gcHsd%2bBrn6vn4%2bArW0gmwv8nw9 如果用户请求http://my.example.com/pages/uc?dc=qXE7kHEIHHiT2Gexv%2bLDy63yqTeh3gcHsd%2bBrn6vn4%2bArW0gmwv8nw9
then it should be rewrite to http://qa.example.com/uc?dc=qXE7kHEIHHiT2Gexv%2bLDy63yqTeh3gcHsd%2bBrn6vn4%2bArW0gmwv8nw9 那么应将其重写为http://qa.example.com/uc?dc=qXE7kHEIHHiT2Gexv%2bLDy63yqTeh3gcHsd%2bBrn6vn4%2bArW0gmwv8nw9
The user should not be able to see the URL changes (user should never know its a different application) 用户应该看不到URL更改(用户永远不应该知道它是另一个应用程序)
<system.webServer>
<rewrite>
<rules>
<rule name="Route the requests for pages" stopProcessing="true">
<match url="^pages/(.*)" />
<conditions>
<add input="{CACHE_URL}" pattern="^(https?)://" />
</conditions>
<action type="Rewrite" url`enter code here`="{C:1}://www.qa.example.com/{R:1}" />
<serverVariables>
<set name="HTTP_ACCEPT_ENCODING" value="" />
</serverVariables>
</rule>
</rules>
<outboundRules>
<rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1">
<match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^http(s)?://www.qa.example.com/(.*)" />
<action type="Rewrite" value="/pages/{R:2}" />
</rule>
<rule name="RewriteRelativePaths" preCondition="ResponseIsHtml1">
<match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^/(.*)" negate="false" />
<action type="Rewrite" value="/pages/{R:1}" />
</rule>
<preConditions>
<preCondition name="ResponseIsHtml1">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>
<urlCompression doStaticCompression="true" doDynamicCompression="false" />
</system.webServer>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.