【问题标题】:IIS Url Rewrite - Subdomain to folder issue results 404IIS Url Rewrite - 子域到文件夹问题结果 404
【发布时间】:2015-01-19 08:06:28
【问题描述】:

我希望 anySubdomain.mydomain.com 的行为与 mydomain.com/anySubdomain 一样。到目前为止我的配置:

  1. 我在 mydomain.com 的 DNS 记录中输入了通配符 CNAME 记录 (*.mydomain.com CNAME mydomain.com)。我很确定这一步没问题。
  2. 我在 IIS 网站的 URL 重写模块中创建了一个入站规则:

    <rewrite>    
    <rules>    
        <rule name="Subdomain to Folder" stopProcessing="true">    
            <match url="(.*)" />    
            <conditions>    
                <add input="{HTTP_HOST}" pattern="[http://]*(.*).mydomain.com" />    
            </conditions>    
            <action type="Rewrite" url="{C:1}/{R:1}" logRewrittenUrl="false" />    
        </rule>    
    </rules>    
    

  3. 我在根文件夹下创建了一个文件夹作为 anySubdomain 并将 index.html 放入其中。我已检查 mydomain.com/anySubdomain 是否获得了我想要的页面。

我在调用 anySubdomain.mydomain.com 时收到 404 页面。我知道这是一个常见问题,但我无法解决这个问题,我的错误在哪里?谢谢。

【问题讨论】:

    标签: asp.net iis url-rewriting dns


    【解决方案1】:

    终于找到答案了,分享给大家。 缺少的步骤是添加以下 IIS 绑定以捕获所有“尚未分配主机名请求”:

    IP Address: IP of web server    
    Port: 80    
    Host: (Leave Blank)    
    

    【讨论】:

      猜你喜欢
      • 2013-10-16
      • 1970-01-01
      • 2013-11-08
      • 2012-09-14
      • 2017-08-24
      • 1970-01-01
      • 1970-01-01
      • 2023-04-07
      • 1970-01-01
      相关资源
      最近更新 更多