regex - Force Https on an ASP.NET app running on IIS 7.5 -


i forcing ssl on entire site following code on web.config file;

<system.webserver>     <rewrite>         <rules>             <rule name="redirect http https" stopprocessing="true">                 <match url="(.*)"/>                 <conditions>                     <add input="{https}" pattern="^off$"/>                 </conditions>                 <action type="redirect" url="https://{http_host}/{r:1}" redirecttype="seeother"/>             </rule>         </rules>     </rewrite> </system.webserver> 

but force ssl ~/purchase/ , ~/account/ path , under them. should match url that?

note regular expressions work me here wildcard.

you should use pattern (this work /purchase/something /account/something-else):

^((purchase|account)/.*)$ 

you have remember, url should have no leading slash /.

<?xml version="1.0" encoding="utf-8"?> <configuration>     <system.webserver>         <rewrite>             <rules>                 <rule name="force https" stopprocessing="true">                     <match url="^((purchase|account)/.*)$" />                     <conditions>                         <add input="{https}" pattern="^off$" />                     </conditions>                     <action type="redirect" url="https://{http_host}/{r:1}" redirecttype="permanent" />                 </rule>             </rules>         </rewrite>     </system.webserver> </configuration> 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -