代码之家  ›  专栏  ›  技术社区  ›  jrummell

如何使用iis7 url rewrite 2.0管理winhost上的子域?

  •  0
  • jrummell  · 技术社区  · 15 年前

    我在尝试 WinHost 我遇到了子域的一些问题。在winhost上,每个宿主帐户可以有多个子域,但每个子域都指向根网站。例如,您可以拥有www.example.com、sub1.example.com和sub2.example.com,但所有这些网站的内容都显示在 http://www.example.com/ .

    其他主机允许您将子域指向网站中的子文件夹。这将允许您将sub1.example.com指向/sub1,将sub2.example.com指向/sub2,并将www.example.com指向/。

    Winhost建议使用 asp/aspx page 重定向 http://sub1.example.com http://sub1.example.com/sub1 ,它指向/sub1。虽然这样可以,但我不希望在url中有两次子域。

    所以我试着用iis7 url重写来指向 http://sub1.example.com网站 到/SUB1。本·鲍威尔在 his blog . 这很好,除了request.applicationpath现在是/sub1/path/to/current/page.aspx,它打破了asp.net的主题(可能还有其他东西)。

    如何修复应用程序路径?有没有更好的方法来实现这一点?

    2 回复  |  直到 14 年前
        1
  •  1
  •   Community CDub    8 年前

    我在服务器上试过运气。也没有有用的答案,但我确实发布了我的解决方案:

    我想不出怎么修理 应用程序路径,所以现在我只是 使用url重写模块 重定向(不重写) http://sub.example.com/abc http://sub.example.com/sub/abc . 它是 不太理想,但确实有效。看我的部落格 发布详细信息。

    https://serverfault.com/questions/134125/how-to-manage-sub-domains-on-winhost-with-iis7-url-rewrite-2-0/135533#135533

        2
  •  1
  •   Arshi Shaikh    14 年前

    阿尔塔夫的文章通过去掉~符号来解释这个决议。看第七点。