使用web.config规则重定向到子域

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

我们迁移托管在主域内“ webapp”目录中的Webapp:

http://www.example.com/webapp/

到没有“ webapp”文件夹的新子域:

http://subdomain.example.com/

我只需要重定向子目录“ webapp”。我不想重定向其他网址,例如http://www.example.com/http://www.example.com/folder1http://www.example.com/folder2,....

但是我们已经发送了很多电子邮件给客户,其中包含<a href="http://www.example.com/webapp/login">LOGIN TO YOUR DASHBOARD</a>或其他链接,例如<a href="http://www.example.com/webapp/data/download.php/id=xxx">DOWNLOAD YOUR DOC</a>。>

现在我正在尝试通过web.config进行重定向,但似乎没有任何作用。

[例如,如果我尝试不导航至http://www.example.com/webapp/login,则不会按预期重定向到http://subdomain.example.com/login/

[例如,如果我尝试不导航至http://www.example.com/webapp/data/download.php/id=43,则不会按预期重定向到http://subdomain.example.com/data/download.php/id=43

任何建议?

<rule name="redirect-to-subdomain" stopProcessing="true">
    <match url="^webapp/$" />
    <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    </conditions>
    <action type="Redirect" url="http://subdomain.example.com/{R:0}" redirectType="Permanent" />
</rule>

我们将托管在主域:http://www.example.com/webapp/中的“ webapp”目录中的webapp迁移到没有“ webapp”文件夹的新子域:http://subdomain.example.com/需要...

asp.net redirect iis web-config
1个回答
0
投票

您的规则除http://www.example.com/webapp/以外均不起作用。

© www.soinside.com 2019 - 2024. All rights reserved.