{"id":6530,"date":"2023-01-05T02:32:57","date_gmt":"2023-01-05T02:32:57","guid":{"rendered":"https:\/\/pariswells.com\/blog\/?p=6530"},"modified":"2023-01-05T02:33:01","modified_gmt":"2023-01-05T02:33:01","slug":"how-to-redirect-http-to-https-on-a-non-standard-port-on-iis-using-url-rewrite","status":"publish","type":"post","link":"https:\/\/pariswells.com\/blog\/research\/how-to-redirect-http-to-https-on-a-non-standard-port-on-iis-using-url-rewrite","title":{"rendered":"How to Redirect Http to HTTPS on a non standard port on IIS using URL ReWrite"},"content":{"rendered":"\n<p>The <a href=\"https:\/\/aboutssl.org\/iis-redirection-http-to-https\/\" title=\"\">standard way in IIS to redirect HTTP to https<\/a> will not work because <strong>http_host<\/strong> contains the port <\/p>\n\n\n\n<p>You need to use Regex Magic : <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2023\/01\/image-9.png\"><img loading=\"lazy\" decoding=\"async\" width=\"795\" height=\"912\" src=\"https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2023\/01\/image-9.png\" alt=\"\" class=\"wp-image-6531 img-responsive\" srcset=\"https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2023\/01\/image-9.png 795w, https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2023\/01\/image-9-262x300.png 262w, https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2023\/01\/image-9-768x881.png 768w\" sizes=\"auto, (max-width: 795px) 100vw, 795px\" \/><\/a><\/figure>\n\n\n\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;rule name=&#8221;HTTP to HTTPS on different SSL Port&#8221; enabled=&#8221;true&#8221; stopProcessing=&#8221;true&#8221;><br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;match url=&#8221;(.*)&#8221; ignoreCase=&#8221;true&#8221; \/><br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;conditions logicalGrouping=&#8221;MatchAll&#8221; trackAllCaptures=&#8221;true&#8221;><br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;add input=&#8221;{HTTPS}&#8221; pattern=&#8221;off&#8221; \/><br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;add input=&#8221;{HTTP_HOST}&#8221; pattern=&#8221;([^\/:]*?):[^\/]*?&#8221; \/><br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;\/conditions><br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;action type=&#8221;Redirect&#8221; url=&#8221;<a href=\"https:\/\/%7Bc:1%7D:1443\/%7BR:0\">https:\/\/{C:1}:8889\/{R:0<\/a>}&#8221; appendQueryString=&#8221;false&#8221; \/><br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;\/rule><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The standard way in IIS to redirect HTTP to https will not work because http_host contains the port You need to use Regex Magic : \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;rule [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1689,1513,1401,4127,4124,1116,1526,4128],"class_list":["post-6530","post","type-post","status-publish","format-standard","hentry","category-research","tag-http","tag-https","tag-iis","tag-internet-information-sevices","tag-non-standard-port","tag-port","tag-redirect","tag-web-config"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/6530","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/comments?post=6530"}],"version-history":[{"count":1,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/6530\/revisions"}],"predecessor-version":[{"id":6532,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/6530\/revisions\/6532"}],"wp:attachment":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/media?parent=6530"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/categories?post=6530"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/tags?post=6530"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}