Redirect HTTP to HTTPS with IIS 10

To redirect a domain to HTTPS, Click on the website in IIS, you will see

If you don’t see the “URL Rewrite” button, you need to install “URL Rewrite” extension

https://www.iis.net/downloads/microsoft/url-rewrite

Click on “URL Rewrite” button. On the next screen click on “Add Rule(s)” link on the right side menu.

IIS URL Rewrite add rule

Select “Blank Rule”, then click OK button.

On the next screen, enter the following details

Name = SSL
Pattern = (.*)

Keep all other options default.

Scroll down, expand “conditions” on the same screen. Click on Add button

Enter the following values, keep everything else default as shown in the above picture.

Condition input = {HTTPS}
Pattern = ^OFF$

Click “OK” button.

Scroll Down to the actions section

Action type = Redirect
Rewrite URL = https://{HTTP_HOST}{REQUEST_URI}
Redirect type =  Permanent (301)

Click “Apply” from the right side “Actions” menu to save the changes.

Method 2: using web.config

Create a file with the name “web.config” in the document root of your website with the following content.



    
        
            
                
                    
                    
                        
                    
                    
                
            
        
    

You need “URL Rewrite” IIS module installed for this to work.

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *