Suppose the website URL is subdomain.company.com
I want to redirect the user to https://subdomain.company.com
only if
- The original request is not using
https
- subdomain matches
subdomain.comapny.com
Relative URL and query string should append as expected.
I cannot edit web.config. So I have to do this via IIS only.
In IIS, I have tried the following but it is not giving desired results-
How could this be achieved?
Best Answer
Your "Match URL" pattern is where you want to define
subdomain.company.com
. Your "Conditions" pattern should beoff
, because you want to redirect when{HTTPS}
is off. Also, if this is a permanent redirect, you may as well change the "Action" toPermanent (301)
.