【发布时间】:2020-08-14 11:45:09
【问题描述】:
我们迁移托管在主域内目录“webapp”中的 webapp:
http://www.example.com/webapp/
到没有“webapp”文件夹的新子域:
http://subdomain.example.com/
我只需要重定向子目录“webapp”。我不想重定向其他网址,例如http://www.example.com/、http://www.example.com/folder1、http://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>
【问题讨论】:
标签: asp.net redirect iis web-config