0

I have my .net core application. The http site is http://www.myfakesite.com:5000 But my https site is https://www.myfakesite.com:5001.

What I want is when I open the http site it will be re-directed to https site.

You see the port is also changed from 5000 to 5001.

I followed the steps, but I don't know how to modify the rule.

Hello
  • 101
  • 1

1 Answers1

0

Based on the URL that you posted, if shows you need to put this in your redirect URL section:

https://{HTTP_HOST}/{R:1}

So it should just be a matter of adding the port as so:

https://{HTTP_HOST}:5001/{R:1}

This should add port 5001 onto the end of the hostname and direct accordingly.

nelgin
  • 79
  • 1
  • 3
  • 1
    I don't think it works as the port number is included in the HTTP_HOST variable. https://stackoverflow.com/questions/19257193/in-iis-url-rewrite-2-0-why-does-http-host-include-the-port-number – Hello Aug 08 '20 at 12:46
  • Good point. I wanted to do it as a comment but I don't have enough points as yet. I guess this didn't help lol. – nelgin Aug 09 '20 at 13:27
  • So please delete your answer. Otherwise your answer might be down voted by other people. Thanks – Hello Aug 12 '20 at 13:12