url - How do can I code a rewrite rule in IIS 8 so that all traffic points to https://www.*.com from http://*.com? -


i have following root level urls people possibly go:

1. http://example.com 2. http://www.example.com 3. https://example.com 4. https://www.example.com 

how can ensure 1, 2, , 3 redirect 4 rewrite rule in iis 8? of course, should keep whatever secondary information attached (e.g. /images/myfile.jpg?query=string&another=string)

you can try rule

<rewrite>   <rules>             <rule name="example.com www.example.com" enabled="true" stopprocessing="true">       <match url="(.*)" />       <conditions logicalgrouping="matchany">         <add input="{http_host}" pattern="www.example.com" negate="true" />         <add input="{https}" pattern="off" />       </conditions>       <action type="redirect" url="https://www.example.com/{r:1}"               redirecttype="permanent" />     </rule>   </rules> <rewrite> 

Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -