IIS 10 子域到文件夹

IIS 10 Subdomain to folder

请帮助我。

我不会说英语,所以如果我有错误,我深表歉意 在我的写作中(我使用 google 翻译):(

使用这些功能创建我的网站:

Bindings > *.holos.mx, holos.mx 
Path > D:\Hosteos

在此目录中D:\Hosteos\web.config 我有规则:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>

        <rewrite>

            <rules>
                <rule name="Imported Rule 0" stopProcessing="true">
                    <match url="^(.*)$" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{HTTP_HOST}" pattern="^(.*)\.holos\.mx" ignoreCase="false" />
                        <!--<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />-->
                    </conditions>
                    <action type="Rewrite" url="{C:1}/{R:1}" appendQueryString="true" /><!-- .php -->
                </rule>

            </rules>
        </rewrite>

        <httpErrors errorMode="Custom">
            <remove statusCode="404" subStatusCode="-1" />
            <error statusCode="404" prefixLanguageFilePath="" path="/404.aspx" responseMode="ExecuteURL" />
        </httpErrors>

    </system.webServer>
</configuration>

创建此文件夹:D:\Hosteos\beta

在这个文件夹中我还有另一个 web.config。 (D:\Hosteos\beta\web.config)

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>

                <clear />
                <rule name="Imported Rule 1">
                    <match url="^life(|/)$"  />
                    <action type="Rewrite" url="test.php" appendQueryString="false" />
                </rule>

            </rules>
        </rewrite>

        <httpErrors errorMode="Custom">
            <remove statusCode="404" subStatusCode="-1" />
            <error statusCode="404" prefixLanguageFilePath="" path="/404.html" responseMode="ExecuteURL" />
        </httpErrors>

    </system.webServer>
</configuration>

问题是当我输入 URL 子域 (http://beta.holos.mx/life) 时显示错误 404

当我输入 URL 基本域 (http://holos.mx/beta/life) 时,它会显示我页面的内容 test.php

我该如何解决?

您需要在重写操作中更改 URL。

你的规则应该是这样的:

<rule name="Imported Rule 0" stopProcessing="true">
    <match url="^(.*)$" />
    <conditions logicalGrouping="MatchAll">
        <add input="{HTTP_HOST}" pattern="^(.*)\.domain\.com" ignoreCase="false" />
    </conditions>
    <action type="Rewrite" url="http://holos.mx/{C:1}/{R:1}" appendQueryString="true" /><!-- .php -->
</rule>