[英]Convert URL to lower case only for ASPX and extension less URLs
我在IIS 7中使用此規則
<rule name="Convert to lower case" enabled="true" stopProcessing="true">
<match url=".*[A-Z].*" ignoreCase="false" />
<conditions>
<add input="{URL}" pattern="(.*)/admin/*" negate="true" />
</conditions>
<action type="Redirect" url="{ToLower:{R:0}}" redirectType="Permanent" />
</rule>
我如何對其進行修改,以使其僅重定向用戶可能在瀏覽器中看到的URL,例如/MyPage.aspx和/ MyPage以及/MyPage.htmL
編輯:我最終使用此:(這解決了DotNetNuke的問題並減少了不必要的重定向)
<rule name="Convert to lower case" enabled="true" stopProcessing="true">
<match url=".*[A-Z].*" ignoreCase="false" />
<conditions>
<add input="{URL}" pattern="(.*)/(admin|desktopmodules|host|tabid)/*" negate="true" />
<add input="{URL}" pattern="^.*\.(xml|ashx|axd|css|js|jpg|jpeg|png|gif)$" negate="true" ignoreCase="true" />
</conditions>
<action type="Redirect" url="{ToLower:{R:0}}" redirectType="Permanent" />
</rule>
對於無擴展名和僅用於小寫的ASPX:
<rule name="LowerCaseRule" stopProcessing="true">
<match url="[A-Z]" ignoreCase="false" />
<action type="Redirect" url="{ToLower:{URL}}" />
<conditions logicalGrouping="MatchAny">
<add input="{REQUEST_FILENAME}" pattern="\.aspx$" />
<add input="{REQUEST_FILENAME}" pattern="\." negate="true" />
</conditions>
</rule>
\\.aspx$
匹配以.aspx
結尾的文件名( $
是行尾)
\\.
匹配文件名中帶有點的任何內容(尚未匹配),並將其從匹配中取反
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.