However, you do need to have CNAMES set up for the sub domains that you want. www is commonly added by default at many registrars, but stuff like dev.xyz.com and all will need to be added via your domain DNS control panel.
Do you have your DNS properly set up? Redirect rules won't help if DNS doesn't know where to send your sub-domains.
And here's a good resource to learn about IIS Redirects. This will explain the {R:1} and the rest of it
A Redirect action has the following configuration options:
url – Uses a substitution string as a redirection URL. A substitution
URL is a string that can include the following: Back-references to the
condition and rule patterns. (For more information, see the section
about how to use back-references.)
So the R:1 rule is simply rewriting whatever URL you put in, just changing the http -> https. This is sent back to the users browser as a permanent redirect, and the browser opens the SSL site. All this happens nearly instantaneously.
It's a bit long ,but go through it and see if any of it makes sense.
Feel free to ask questions after
Redirect rule from url with subdomain to https?
How would I write the folowing rewrite rules for the following urls:
dev.site.com => https:\\dev.site.com
http:\\dev.site.com => https:\\dev.site.com
qa.site.com => https:\\qa.site.com
http:\\qa.site.com => https:\\qa.site.com
dev-sub.site2.com => https:\\dev-sub.site2.com
http:\\dev-sub.site2.com => https:\\dev-sub.site2.com
The sites will either have dev., qa. or dev- in the url as well as a different domain site1 or site2
Try this in your web.config
Hi Can you explain what is happening here like what does {R:1} mean?
What if I want to add
www to a url
liketest.com
so it becomeshttps://www.test.com
, butdev.test.com
would just becomehttps://dev.test.com
?Thanks
Hey,
This rule will cover your use cases - it takes
http://<anything>.domain.com
and redirects that tohttps://<anything>.domain.com.
However, you do need to have CNAMES set up for the sub domains that you want. www is commonly added by default at many registrars, but stuff like dev.xyz.com and all will need to be added via your domain DNS control panel.
Do you have your DNS properly set up? Redirect rules won't help if DNS doesn't know where to send your sub-domains.
And here's a good resource to learn about IIS Redirects. This will explain the {R:1} and the rest of it
https://www.iis.net/learn/extensions/url-rewrite-module/url-rewrite-module-configuration-reference
Specifically, look at this part
So the R:1 rule is simply rewriting whatever URL you put in, just changing the http -> https. This is sent back to the users browser as a permanent redirect, and the browser opens the SSL site. All this happens nearly instantaneously.
It's a bit long ,but go through it and see if any of it makes sense. Feel free to ask questions after
is working on a reply...