2012-09-04 131 views
0

我是Url重写规则的新手,所以任何帮助都会感激不尽。IIS网址重写规则

想要创建IIS URL重写将处理以下任何

http://localhost/homepage/contact-us.aspx -> http://localhost/contact-us.aspx 
http://localhost/homepage/about-us.aspx -> http://localhost/about-us.aspx 

任何想法?

回答

0

我还没有测试过这个,但我想你会在你的web.config文件中有这样的东西。

您可以编辑web.config文件,然后进入IIS,如果要测试它,则应显示规则。

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.webServer> 
     <rewrite> 
      <rules> 
       <rule name="rewriterule1" enabled="true" stopProcessing="false"> 
        <match url="homepage/(.*)" /> 
        <action type="Rewrite" url="http://localhost/{R:1}" /> 
       </rule> 
      </rules> 
     </rewrite> 
    </system.webServer> 
</configuration>