[英]Iis7 URL rewrite for whole directory, stripping index.aspx
IIS7 Windows 2008 Server 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/
我走來走去,希望能有所幫助。
謝謝。
將此添加到/ 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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.