2

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>

/MyPage.aspx や /MyPage、おそらく /MyPage.htmL など、ユーザーがブラウザーで表示する可能性が高い URL のみをリダイレクトするように変更するにはどうすればよいですか

編集:私はこれを使用することになりました:(これは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>
4

1 に答える 1

1

Extensionless および 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($は行末) で終わるファイル名に一致します。

\.ファイル名にドットが含まれるもの (まだ一致していないもの) に一致し、一致から除外します

于 2013-11-04T22:48:46.767 に答える