As an alternative solution, I use the following rule to force HTTPS requests on a web site. This can be added to web.config. You'll need IIS Url Rewrite installed on your web server for this to work. The rule below uses the current request's host so it will work for any site.
I prefer using a web.config rule as the redirect is performed by IIS, not the application. I assume this would speed things up slightly and also allow the application not to have to worry about whether a connection is secure or not.
I have an umbraco instrance containing two sites with a domain mapping each. I need one of them to run https, but cant get the above redirect to work...
Redirect to https
Hi,
I'm trying to create a simple rewrite rule to force https and add www on a certain domain.
Any idea why this doesn't work? Seems to just be ignored.
Thank you,
Amir
Hi Amir,
As an alternative solution, I use the following rule to force HTTPS requests on a web site. This can be added to web.config. You'll need IIS Url Rewrite installed on your web server for this to work. The rule below uses the current request's host so it will work for any site.
If you wanted it to work for a certain domain only, you could replace the
{HTTP_HOST}
reference with a specific domain.I hope that helps.
Thanks, Dan.
Hi Dan, I'd like to do this for just one domain on the site though...Any advantage to doing this in web.config vs urlrewriting.config?
This was helpful - thanks!
Hi Amir,
You could just amend the rule to the following line if you just wanted to for secure connections for just one domain:
I prefer using a web.config rule as the redirect is performed by IIS, not the application. I assume this would speed things up slightly and also allow the application not to have to worry about whether a connection is secure or not.
Thanks, Dan.
I have an umbraco instrance containing two sites with a domain mapping each. I need one of them to run https, but cant get the above redirect to work...
it triggers on both mysite.dk and mytohersite.dk. myothersite.dk gets redirected to mysite.dk
How do i set it up so its only http://www.mysite.dk that gets redirected to https://www.mysite.dk?
Try this, these are the domains you want to force https on, the others will default to http.
/
is working on a reply...