【问题标题】:Iis7 URL rewrite for whole directory, stripping index.aspx整个目录的 iis7 URL 重写,剥离 index.aspx
【发布时间】:2012-03-06 02:34:01
【问题描述】:

iis7 windows 2008 服务器 iis 重写模块 .net 4

非常简单的问题,我正在使用重写模块,发现它非常好,但我需要帮助设置一个我似乎无法正确的规则。

http://www.vinylsearcher.com/dance-music/downtempo-records/

标准: 对 dance-music 文件夹的任何请求都必须将 index.aspx 从末尾剥离,这样它就会像这样结束:

http://www.vinylsearcher.com/dance-music/downtempo-records/

没有

http://www.vinylsearcher.com/dance-music/downtempo-records/index.aspx

但也必须为:

http://www.vinylsearcher.com/dance-music/downtempo-records/mostexpensive/index.aspx

需要改写为:

http://www.vinylsearcher.com/dance-music/downtempo-records/mostexpensive/

我已经转了一圈又一圈,希望能得到一些帮助。

谢谢。

【问题讨论】:

    标签: .net iis-7 rewrite


    【解决方案1】:

    将此添加到 /defaultDocument 部分下的 web.config 文件中:

    <rewrite>
        <rules>
          <rule name="Imported Rule 1" stopProcessing="true">
          <match url=".*" ignoreCase="false" />
          <conditions>
            <add input="{URL}" pattern="^/(media|skin|js)/" ignoreCase="false" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
          </conditions>
          <action type="Rewrite" url="index.aspx" />
          </rule>
        </rules>
    </rewrite>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-02-14
      • 1970-01-01
      • 2023-03-17
      • 2012-01-01
      • 2011-07-30
      • 2011-04-07
      • 2014-05-06
      相关资源
      最近更新 更多