{"id":386,"date":"2019-04-22T16:11:06","date_gmt":"2019-04-22T21:11:06","guid":{"rendered":"http:\/\/itblog.ldlnet.net\/?p=386"},"modified":"2019-05-01T17:06:06","modified_gmt":"2019-05-01T22:06:06","slug":"http-to-https-redirect-for-websites-in-iis","status":"publish","type":"post","link":"https:\/\/itblog.ldlnet.net\/index.php\/2019\/04\/22\/http-to-https-redirect-for-websites-in-iis\/","title":{"rendered":"HTTP to HTTPS redirect for websites in IIS"},"content":{"rendered":"\n<p>I&#8217;ve been building this blog along with my consulting business and needed to secure my websites with SSL for BBB accreditation. That accreditation is still pending at this time, but I want to show good faith in business practices to attain that accreditation. <\/p>\n\n\n\n<p>So, I purchased my certificate and preformed the following to assure that all traffic to my websites are SSL secured. There are a number of ways to do it, and even do it for Exchange, (which I will cover in  another post), but I found a great article that is simple and will work for most standard web sites. The link will be at the bottom in the references section. \ud83d\ude42<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" style=\"text-align:left\">Redirect all HTTP traffic for your website to HTTPS<\/h4>\n\n\n\n<ul class=\"wp-block-list\"><li>You will need to download the URL Rewrite Tool: Instructions <a aria-label=\"HERE (opens in a new tab)\" href=\"http:\/\/www.iis.net\/learn\/extensions\/url-rewrite-module\/using-the-url-rewrite-module\" target=\"_blank\" rel=\"noreferrer noopener\"><em>HERE<\/em><\/a><\/li><li>Ensure that the IIS site you are using is configured for the proper port 80 binding. In this case we are listening for all traffic on port 80. But you could restrict this based on host header as needed<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"523\" height=\"417\" src=\"https:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/04\/image-1.png\" alt=\"\" class=\"wp-image-387\" srcset=\"https:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/04\/image-1.png 523w, https:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/04\/image-1-300x239.png 300w\" sizes=\"auto, (max-width: 523px) 100vw, 523px\" \/><\/figure><\/div>\n\n\n\n<ul class=\"wp-block-list\"><li>Next, once URL Rewrite is installed, create a new URL Rewrite Rule on the website that you want to make the change on:<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"493\" height=\"638\" src=\"https:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/04\/image-2.png\" alt=\"\" class=\"wp-image-388\" srcset=\"https:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/04\/image-2.png 493w, https:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/04\/image-2-232x300.png 232w\" sizes=\"auto, (max-width: 493px) 100vw, 493px\" \/><figcaption>Steps to create a new URL Rewrite Rule<\/figcaption><\/figure><\/div>\n\n\n\n<ul class=\"wp-block-list\"><li>Use the following steps exactly to create the redirection properly for your website:<\/li><li>Match URL Setting:\n<ul><li>Name your rule (i.e. &#8216;http to https&#8217;)<\/li>\n<li>Requested URL: &#8216;Matches the Pattern&#8217;<\/li>\n<li>Using: &#8216;Wildcards&#8217;<\/li><li>Pattern: &#8216;*&#8217;<\/li>\n<li>Ignore Case: &#8216;Checked&#8217;<\/li><\/ul>\n<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"702\" height=\"347\" src=\"https:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/04\/image-3.png\" alt=\"\" class=\"wp-image-389\" srcset=\"https:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/04\/image-3.png 702w, https:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/04\/image-3-300x148.png 300w\" sizes=\"auto, (max-width: 702px) 100vw, 702px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Conditions Setting:<ul><li>Click Add<\/li><li>Condition Input: &#8216;{HTTPS}&#8217;<\/li><li>Check if input string: &#8216;Matches the pattern&#8217;<\/li><li>Pattern: &#8216;off&#8217;<\/li><li>Ignore Case: &#8216;Checked&#8217;<\/li><\/ul><\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"1017\" height=\"312\" src=\"https:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/04\/image-4.png\" alt=\"\" class=\"wp-image-390\" srcset=\"https:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/04\/image-4.png 1017w, https:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/04\/image-4-300x92.png 300w, https:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/04\/image-4-768x236.png 768w\" sizes=\"auto, (max-width: 1017px) 100vw, 1017px\" \/><\/figure><\/div>\n\n\n\n<ul class=\"wp-block-list\"><li>Server Variables Setting:<ul><li>No Settings Changed or Added<\/li><\/ul><\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"668\" height=\"245\" src=\"https:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/04\/image-5.png\" alt=\"\" class=\"wp-image-391\" srcset=\"https:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/04\/image-5.png 668w, https:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/04\/image-5-300x110.png 300w\" sizes=\"auto, (max-width: 668px) 100vw, 668px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Action Setting:<ul><li>Action Type: &#8216;Redirect&#8217;<\/li><li>Action Properties<ul><li>Redirect URL: &#8216;https:\/\/{HTTP_HOST}{REQUEST_URI}&#8217;<\/li><li>Append Query String: &#8216;Checked&#8217;<\/li><li>Redirect Type: Found (302)<\/li><\/ul><\/li><\/ul><\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"668\" height=\"303\" src=\"https:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/04\/image-6.png\" alt=\"\" class=\"wp-image-392\" srcset=\"https:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/04\/image-6.png 668w, https:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/04\/image-6-300x136.png 300w\" sizes=\"auto, (max-width: 668px) 100vw, 668px\" \/><\/figure><\/div>\n\n\n\n<p class=\"has-text-color has-small-font-size has-medium-pink-color\">Note: In this example {HTTPS}, {HTTP_HOST}, and {REQUEST_URI} are all URL parts that can be accessed using the URL Rewrite module. More information on URL parts can be found <a href=\"http:\/\/www.iis.net\/learn\/extensions\/url-rewrite-module\/url-rewrite-module-configuration-reference#Accessing_URL_Parts_from_a_Rewrite_Rule\"><em>here<\/em><\/a><em>.<\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Apply the rule so that it is saved to IIS<\/li><li>Perform an IISRESET from an Administrative PowerShell Session or Command Prompt to Enable all the settings properly<\/li><\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">Changes Made<\/h4>\n\n\n\n<p>The URL rewrite rules get written to the web.config file for the site you are working in. For example, the above configuration should result in this addition to the web.config file:<\/p>\n\n\n<pre class=\"lang:xml\" title=\"web.config file modifications with URL Rewrite\">\n<rewrite>\n\t<rules>\n\t\t<rule name=\"Redirect to http\" enabled=\"true\" patternSyntax=\"Wildcard\" stopProcessing=\"true\">\n\t\t\t<match url=\"*\" negate=\"false\" \/>\n\t\t\t<conditions logicalGrouping=\"MatchAny\">\n\t\t\t\t<add input=\"{HTTPS}\" pattern=\"off\" \/>\n\t\t\t<\/conditions>\n\t\t\t<action type=\"Redirect\" url=\"https:\/\/{HTTP_HOST}{REQUEST_URI}\" redirectType=\"Found\" \/>\n\t\t<\/rule>\n\t<\/rules>\n<\/rewrite>\n<\/pre>\n\n\n\n<p>That should take of it all for you and now when users connect to your website via http, they will be automatically redirected to https SSL.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" style=\"text-align:center\">HAPPY CONFIGURING!<br>PLEASE COMMENT!<\/h2>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"700\" src=\"http:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/04\/LDLNET-GoogleAds-700x700.png\" alt=\"LDLNET - Banner\" class=\"wp-image-381\" srcset=\"https:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/04\/LDLNET-GoogleAds-700x700.png 700w, https:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/04\/LDLNET-GoogleAds-700x700-150x150.png 150w, https:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/04\/LDLNET-GoogleAds-700x700-300x300.png 300w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><figcaption>LDLNET LLC &#8211; Life In Action! Your Source for Professional IT Services!<\/figcaption><\/figure>\n\n\n\n<p class=\"has-small-font-size\"><strong>References:<\/strong><br><strong><em><a aria-label=\"Creating Rewrite Rules for the URL Rewrite Module (opens in a new tab)\" href=\"http:\/\/www.iis.net\/learn\/extensions\/url-rewrite-module\/creating-rewrite-rules-for-the-url-rewrite-module\" target=\"_blank\" rel=\"noreferrer noopener\">Creating Rewrite Rules for the URL Rewrite Module<\/a><\/em><\/strong><br><strong><em><a aria-label=\"URL Rewrite for IIS7 http to https redirection (opens in a new tab)\" href=\"http:\/\/tech.mikeal.com\/blog1.php\/url-rewrite-for-iis7-http-to-https-redirection\" target=\"_blank\" rel=\"noreferrer noopener\">URL Rewrite for IIS7 http to https redirection<\/a><\/em><\/strong><br><strong><em><a aria-label=\"URL Component Reference (opens in a new tab)\" href=\"http:\/\/www.iis.net\/learn\/extensions\/url-rewrite-module\/url-rewrite-module-configuration-reference#Accessing_URL_Parts_from_a_Rewrite_Rule\" target=\"_blank\" rel=\"noreferrer noopener\">URL Component Reference<\/a><\/em><\/strong><br><strong><em><a aria-label=\"Redirect from HTTP to HTTPS using the IIS URL Rewrite module (opens in a new tab)\" href=\"https:\/\/blogs.technet.microsoft.com\/dawiese\/2016\/06\/07\/redirect-from-http-to-https-using-the-iis-url-rewrite-module\/\" target=\"_blank\" rel=\"noreferrer noopener\">Redirect from HTTP to HTTPS using the IIS URL Rewrite module<\/a><\/em><\/strong><br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been building this blog along with my consulting business and needed to secure my websites with SSL for BBB accreditation. That<\/p>\n<p class=\"link-more\"><a class=\"myButt \" href=\"https:\/\/itblog.ldlnet.net\/index.php\/2019\/04\/22\/http-to-https-redirect-for-websites-in-iis\/\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":159,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,1,16],"tags":[173,174,170,176,127,116,172,115,175],"class_list":["post-386","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-general","category-uncategorized","category-windows","tag-http","tag-https","tag-iis","tag-iisreset","tag-ssl","tag-url","tag-url-rewrite","tag-website","tag-websites","odd"],"_links":{"self":[{"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/posts\/386","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/comments?post=386"}],"version-history":[{"count":5,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/posts\/386\/revisions"}],"predecessor-version":[{"id":419,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/posts\/386\/revisions\/419"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/media\/159"}],"wp:attachment":[{"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/media?parent=386"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/categories?post=386"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/tags?post=386"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}