如何使用IIS7 URL重写模块重定向到应用程序根目录?

TN.*_*TN. 7 iis iis-7 web-applications url-rewriting url-rewrite-module

我试过了:

1)我先尝试空字符串:

<action type="Redirect" url="" redirectType="Permanent" appendQueryString="false" />
Run Code Online (Sandbox Code Playgroud)

结果:

HTTP 500.52 - URL Rewrite Module Error.
The substitution URL for the current action cannot be empty.
Run Code Online (Sandbox Code Playgroud)

2)也许我应该省略url属性:

<action type="Redirect" redirectType="Permanent" appendQueryString="false" />
Run Code Online (Sandbox Code Playgroud)

相同的结果:

HTTP 500.52 - URL Rewrite Module Error.
The substitution URL for the current action cannot be empty.
Run Code Online (Sandbox Code Playgroud)

3)ASP.NET方式怎么样:

<action type="Redirect" url="~" redirectType="Permanent" appendQueryString="false" />
Run Code Online (Sandbox Code Playgroud)

尝试重定向到{APP_ROOT}/~.

4)最后一次尝试:

<action type="Redirect" url="/" redirectType="Permanent" appendQueryString="false" />
Run Code Online (Sandbox Code Playgroud)

正如所料,它重定向到服务器的根目录......

我想找一些干净的通用解决方案.(我不能用一些具体的东西/myCurrentAppPath.)

nsi*_*nov 5

这效果更好:

<action type="Redirect" url="." redirectType="Permanent" appendQueryString="false" />
Run Code Online (Sandbox Code Playgroud)