Tuesday, April 10, 2018

iis 7.5 - IIS 7.5 SSL Redirect



I had a standard website hosted on a server I have full control over - www.domain.com. I recently purchased an SSL certificate for this domain in preparation for accepting credit cards and am looking to have all requests redirect to https://www.domain.com. For the most part, the rule I created (see below) works fine - if I type in http://www.domain.com it'll redirect to https://www.domain.com. The problem I have is if I go to an inner link, such as http://www.domain.com/folder/page.aspx, I get a 404 because the only binding ties to HTTPS. How can I make a redirect rule that says any request for www.domain.com gets sent to HTTPS, but retain the original folder/page structure that was requested? So, going to http://www.domain.com/folder/page.aspx sends me to https://www.domain.com/folder/page.aspx. I'd prefer if query string values also stayed intact.



Here is my current rewrite rule:



   












Answer



I ended up solving it on my own - I did a combination of two different rules (one to rewrite http://domain.com to https://www.domain.com where the cert is linked to) and another to just redirect all HTTPS requests and it seems to be working perfectly. Here is the relevant config entry:




   




















No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...