向web.config添加代码以隐藏我的页面扩展名



我有这个web.config文件,我想向其中添加一个代码,该代码将隐藏我的网站中名为"users.asp"的页面的.asp

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <httpErrors errorMode="Detailed" />
  </system.webServer>
</configuration>

显然,您需要安装URL重写模块,并且您需要IIS7或更高版本,这在IIS6 上不起作用

<rewrite>
        <rules>
             <rule name="RewriteUserFriendlyURL1" stopProcessing="true">
                <match url="^users/$" />
                <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                </conditions>
                <action type="Rewrite" url="users.asp" />
            </rule>
        </rules>
    </rewrite>

推荐阅读:http://www.iis.net/learn/extensions/url-rewrite-module/using-the-url-rewrite-module

最新更新