IIS 10子域到文件夹

问题描述 投票:0回答:1

请帮帮我。

我不会说英语,所以如果我在写作中犯错误,我会道歉(我使用谷歌翻译):(

使用以下功能创建我的网站:

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 \测试\的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的内容

我该如何解决?

.htaccess iis web-config
1个回答
0
投票

您需要在重写操作中更改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>
© www.soinside.com 2019 - 2024. All rights reserved.