【问题标题】:URL Rewrite to different port based on conditionURL 根据条件重写到不同的端口
【发布时间】:2014-01-25 10:33:47
【问题描述】:

我有一个类似这样的网站:

https://www.website.org/cms

我有一个应用程序正在同一服务器上的另一个服务上运行,我希望通过此 URL 访问该端口:

https://www.website.org/dashboard

可以使用http://localhost:8081/dashboard从服务器访问仪表板站点

如何使用 URL 重写来实现这一点?

【问题讨论】:

    标签: iis-7.5 url-rewrite-module


    【解决方案1】:

    其实很简单:

    <rewrite>
       <rules>
          <rule name="dashboard">
             <match url="(dashboard.+)" />
             <action type="Rewrite" url="http://localhost:8081/{R:0}" />
          </rule>
       </rules>
    </rewrite>
    

    【讨论】:

    • 你把规则放在哪里了?在机器(主机)级别还是在网站级别(在 wehre website.org 绑定的级别)?它是否也适用于同一台机器上的请求?
    猜你喜欢
    • 2015-03-15
    • 2014-04-01
    • 2021-04-09
    • 2012-07-19
    • 2016-07-05
    • 2012-10-22
    • 2019-11-04
    • 2021-03-18
    • 2021-09-15
    相关资源
    最近更新 更多