giammin

IIS URL Rewriting Rules Collection

Mar 13th, 2013
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 1.01 KB | None | 0 0
  1. <rewrite>
  2.     <rules>
  3.         <1--avoid annoying 400 404 error from java bots-->
  4.         <rule name="no-java-bots" stopProcessing="true">
  5.             <match url="(.*)" />
  6.             <conditions>
  7.                 <add input="{HTTP_USER_AGENT}" pattern="^Java/.*" ignoreCase="true"/>
  8.             </conditions>
  9.             <action type="AbortRequest" />
  10.         </rule>
  11.         <rule name="Remove www" stopProcessing="false">
  12.             <match url="(.*)" />
  13.             <conditions logicalGrouping="MatchAll">
  14.                 <add input="{HTTP_HOST}" pattern="^www\.(.+)$"  ignoreCase="true" />
  15.             </conditions>
  16.             <!--redirectType="Permanent" 301 redirect-->
  17.             <action type="Redirect" url="http://{C:1}/{R:0}" appendQueryString="true" redirectType="Permanent" />
  18.         </rule>        
  19.         <rule name="HTTP to HTTPS redirect" stopProcessing="true">
  20.             <match url="(.*)" />
  21.             <conditions>
  22.                 <add input="{HTTPS}" pattern="off" ignoreCase="true" />
  23.             </conditions>
  24.             <!--redirectType="Found" 302 redirect-->
  25.             <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
  26.         </rule>
  27.     </rules>
  28. </rewrite>
Advertisement
Add Comment
Please, Sign In to add comment