我试图find一个解决scheme,并find了一些指导,但似乎没有工作。
我有以下url – http://www.mysite.com/aboutus.html
不过,还有一些其他网站链接到我的旧托pipe网站,并指向http://www.mysite.com/nw/aboutus.html 。 我的问题在这里试图从url中删除'nw'目录。
我已经在IIS中设置了以下URL重写,但它似乎没有做任何事情,
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="Redirect all to root folder" enabled="true" stopProcessing="true"> <match url="^nw$|^/nw/(.*)$" /> <conditions> </conditions> <action type="Redirect" url="nw/{R:1}" /> </rule> <rule name="RewriteToFile"> <match url="^(?!nw/)(.*)" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="/{R:1}" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
任何有识之士将不胜感激。
能够解决这个问题与以下
<rule name="RemoveDirectory"> <match url="nw/(.*)" /> <action type="Rewrite" url="/{R:1}" /> <conditions> <add input="{HTTP_HOST}" pattern="^www.mysite.com$" /> </conditions>