【问题标题】:Using URL Rewrites to allow 1 IP address to host two subdomains使用 URL 重写以允许 1 个 IP 地址托管两个子域
【发布时间】:2011-06-15 01:41:33
【问题描述】:

我有一个场景,我需要两个不同的子域通过防火墙并被重写或重定向到服务器上的区域。例如,如果我在外部输入了 sub1.mydomain.com/testsub1.html,我希望它访问 IIS“默认网站/文件夹/sub1/testsub1.html”,同样,如果 sub2.mydomain.com/testsub2.html收到我希望它转到“默认网站/文件夹/sub2/testsub2.html”。我们被告知 URL Rewritew 将是解决这个问题的方法。因此,我们在默认网站中设置规则,将 MatchURL 模式用于: 1. sub1.mydomain.com(.) 并将其重写为“默认网站/文件夹/sub1(R:1)”,操作类型为重写。 2. sub2.mydomain.com(.) 并将其重写为“默认网站/文件夹/sub2(R:1)”,操作类型为重写。

如果我点击http://sub1.mydomain.com/testsub1.html,我会收到文件未找到错误。我在日志中看到的是 GET /testsub1.html。如果我将 URL 更改为 http://sub1.mydomain.com/folders/sub1/testsub1.html,它会完美运行,我会在日志中看到 GET /folders/sub1/testsub1.html,并且浏览器中会显示正确的页面。

如果没有完整路径,我缺少什么来完成这项工作?

【问题讨论】:

    标签: iis url-rewriting


    【解决方案1】:

    绑定是处理这个问题的最佳方式。他们可以在同一个 IP 地址上监听不同的主机名。在 IIS 中创建两个单独的网站,并为该特定子域配置它们的每个绑定。

    更多信息:http://blogs.technet.com/b/chrad/archive/2010/01/24/understanding-iis-bindings-websites-virtual-directories-and-lastly-application-pools.aspx

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-04-13
      • 1970-01-01
      • 2013-07-02
      • 1970-01-01
      • 2013-02-27
      • 2014-07-23
      • 2014-12-17
      • 2012-11-30
      相关资源
      最近更新 更多