asp.net - Conditoinal HTTP redirect IIS 7 -


currently redirecting http requests https want add condition if url contains 'admin' redirect http requests https, how can change rule achieve (e.g. http://www.example.com/admin/index.html) ?

 <rule name="http https redirect" stopprocessing="true">       <match url="(.*)" />       <conditions>         <add input="{https}" pattern="off" ignorecase="true" />       </conditions>       <action type="redirect" redirecttype="found" url="https://{http_host}{request_uri}" />     </rule> 

change url pattern to:

<match url=".*admin/.*" /> 

this seems match sample data ok in iis pattern match tool.

to match additional portions, e.g. profile can alter regular expression:

<match url=".*(admin|profile)/.*" /> 

if going start admin or profile can tighten regular expression ^(admin|profile)/.* (^ means start of pattern, see defining pattern on screen).


Comments