Zoomtutorials
  • Tutorials
    • DevOps
      • Terraform
      • Git
      • GitHub
      • Jenkins
      • Docker
      • Kubernetes
      • Ansible
      • Python
      • Azure DevOps
      • AWS DevOps
    • Cloud
      • AWS
      • Azure
      • GCP
      • Oracle Cloud
      • Alibaba Cloud
      • IBM Cloud
      • DigitalOcean
      • Linode
    • Microsoft Dynamics ERP
      • Dynamics 365
        • D365 FnO
        • D365 BC
      • Dynamics AX
      • Dynamics NAV
      • Dynamics GP
      • Dynamics CRM
    • Azure DevOps
      • Azure Boards
      • Azure Repos
      • Azure Pipelines
      • Azure Test Plans
      • Azure Artifacts
      • Extensions Marketplace
    • AWS DevOps
      • CodeStar
      • CodeCommit
      • CodeBuild
      • CodeDeploy
      • CodePipeline
      • CodeArtifact
    • Web Server
      • IIS
      • Apache
      • NGINX
      • Tomcat
      • NodeJS
    • Microsoft
      • Office 365
      • Microsoft 365
      • SharePoint
      • MS Dynamics ERP
  • Development
    • Application
      • Magento 2
      • Magento
      • WordPress
      • PHP
      • .Net
      • .Net Core
      • NodeJS
      • JAVA
    • Database
      • Microsoft SQL Server
      • MySQL
      • MariaDB
      • Amazon Aurora
      • SQL Proxy
  • HowTos
    • Linux OS
      • RHEL
      • Ubuntu
      • CentOS
      • Fedora
      • Debian
    • Linux Tips
      • Linux Commands
      • Linux Tricks
      • Linux Cheatsheet
    • Windows OS
      • Server 2019
      • Server 2016
      • Server 2012
      • Server 2008
      • Windows 11
      • Windows 10
      • Windows 8
      • Windows 7
    • Windows Tips
      • Windows Commands
      • Windows Shortcuts
  • Tools
    • Monitoring
      • New Relic
      • ELK Stack
    • Security
      • Firewall
      • Internet Security
      • Antivirus
    • Backup
      • SQL Backup
      • Iperius Backup
  • Courses
  • News
  • Submit Tutorials
  • More…
    • Services
    • Write For Us
    • Hire Us
    • Community
    • Donate ❤️
    • Contact Us
Facebook Twitter Instagram
Zoomtutorials
  • Tutorials
    • DevOps
      • Terraform
      • Git
      • GitHub
      • Jenkins
      • Docker
      • Kubernetes
      • Ansible
      • Python
      • Azure DevOps
      • AWS DevOps
    • Cloud
      • AWS
      • Azure
      • GCP
      • Oracle Cloud
      • Alibaba Cloud
      • IBM Cloud
      • DigitalOcean
      • Linode
    • Microsoft Dynamics ERP
      • Dynamics 365
        • D365 FnO
        • D365 BC
      • Dynamics AX
      • Dynamics NAV
      • Dynamics GP
      • Dynamics CRM
    • Azure DevOps
      • Azure Boards
      • Azure Repos
      • Azure Pipelines
      • Azure Test Plans
      • Azure Artifacts
      • Extensions Marketplace
    • AWS DevOps
      • CodeStar
      • CodeCommit
      • CodeBuild
      • CodeDeploy
      • CodePipeline
      • CodeArtifact
    • Web Server
      • IIS
      • Apache
      • NGINX
      • Tomcat
      • NodeJS
    • Microsoft
      • Office 365
      • Microsoft 365
      • SharePoint
      • MS Dynamics ERP
  • Development
    • Application
      • Magento 2
      • Magento
      • WordPress
      • PHP
      • .Net
      • .Net Core
      • NodeJS
      • JAVA
    • Database
      • Microsoft SQL Server
      • MySQL
      • MariaDB
      • Amazon Aurora
      • SQL Proxy
  • HowTos
    • Linux OS
      • RHEL
      • Ubuntu
      • CentOS
      • Fedora
      • Debian
    • Linux Tips
      • Linux Commands
      • Linux Tricks
      • Linux Cheatsheet
    • Windows OS
      • Server 2019
      • Server 2016
      • Server 2012
      • Server 2008
      • Windows 11
      • Windows 10
      • Windows 8
      • Windows 7
    • Windows Tips
      • Windows Commands
      • Windows Shortcuts
  • Tools
    • Monitoring
      • New Relic
      • ELK Stack
    • Security
      • Firewall
      • Internet Security
      • Antivirus
    • Backup
      • SQL Backup
      • Iperius Backup
  • Courses
  • News
  • Submit Tutorials
  • More…
    • Services
    • Write For Us
    • Hire Us
    • Community
    • Donate ❤️
    • Contact Us
Facebook Twitter Instagram YouTube LinkedIn
Zoomtutorials
Home»Tutorials»Web Server»IIS»URL Rewrite – Redirect http to https in IIS
IIS

URL Rewrite – Redirect http to https in IIS

Choudhury SBy Choudhury SJuly 7, 2018Updated:April 18, 2019No Comments2 Mins Read
Facebook Twitter Pinterest LinkedIn Tumblr Email
Share
Facebook Twitter LinkedIn Pinterest Email

Redirecting HTTP to HTTPS is the most common requirement we receive as a sysadmin. Below are the steps to perform the task.

  1. Make sure you’ve got the URL rewrite module installed in IIS. If you aren’t sure if you do or not, you’ll find out quickly when you can’t find “URL Rewrite” in the steps below. Here are downloads for the 32bit version or the 64bit version.
  2. After you install the URL Rewrite module, you can perform the task in two ways: IIS GUI and web.config XML. I prefer doing this through the web.config file, but the GUI will also be shown here.

Requirement

To redirect http://mydomain.com -> https://mydomain.com

Using web.config XML:
Create, if it doesn’t exist already, a   <system.webServer>  section and copy & paste the following code. Be sure to replace mydomain with the hostname of your website.

<!-- Redirect to HTTPS -->
        <rewrite>
            <rules>
                <rule name="http to https" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="^OFF$" />
                    </conditions>
                    <action type="Redirect" url="https://www.domain.com/{R:1}" redirectType="Permanent" />
                </rule>
            </rules>
        </rewrite>

Using IIS URL Rewrite GUI:
1. Select your website in IIS Manager and then click on the “URL Rewrite” option in the features pane.

img 5b40bce5669bc - URL Rewrite - Redirect http to https in IIS

2. Once URL Rewrite screen is open, click the “Add Rules…” link in the right hand pane and enter the details as shown below.
3. Select Blank Rule from the inbound rules section.
4. Give it a descriptive name.
5. Match URL section:

  • Set Requested URL to Matches the Pattern.
  • Set Using to Regular Expression
  • Set Pattern to (.*)

img 5b411d2b2d1ca - URL Rewrite - Redirect http to https in IIS

7. Next in the Conditions section. Click Add

  • Set Condition Input to {HTTPS}
  • Set Check if Input String to Matches the Pattern
  • Set Pattern to ^OFF$
  • Click OK

img 5b411d7fdccd1 - URL Rewrite - Redirect http to https in IIS

8. In the Actions section

  • Set Action Type to Redirect
  • Set Redirect URL to https://{HTTP_HOST}/{R:1}
  • Set Redirect Type to Permanent(301)
  • Click Apply

img 5b411d993b870 - URL Rewrite - Redirect http to https in IIS

Now all request to that site should be redirected (301 permanent redirects) to the https version of the site.

 

https iis url redirect
Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
Choudhury S
  • Website

Choudhury is the founder and chief editor of ZoomTutorials Blog, a leading tutorials and technology blogging site specializing in DevOps, SysAdmin and Cloud Technologies to help IT professionals in their day to day work. He is a Senior Cloud and DevOps Solutions Engineer at a leading eCommerce development Company and has more than 10+ years of Cloud, DevOps and SysAdmin experience working with Fortune 500 companies to solve their most important IT backbones. He lives in Hyderabad with his wife and a son.

Related Posts

How to Use the slmgr Command in Windows

August 27, 2021

How To Extend Windows Server Evaluation after Trial Period Expiry

August 26, 2021

Azure Application Gateway Web Application Firewall (WAF)

March 28, 2020
0 0 votes
Article Rating
Subscribe
Notify of
guest
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments

Buy Me a Coffee Plz...

Get our latest tutorials
Recent Posts
  • How to Use the slmgr Command in Windows
  • How To Extend Windows Server Evaluation after Trial Period Expiry
  • List of Useful Magento 2 Commands
  • Magento 2 Commands and the Use Cases
  • MySQL and MariaDB Performance Tuning and Optimization
  • Microsoft Dynamics AX End of Support/Life
  • Magento Community read/write splitting with Database Proxy
  • Git Commands for developers and sysadmins
  • Install the git credential-oskeychain
  • Install Git on Windows, Linux and Mac
June 2022
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
27282930  
« Aug    
Archives
Site Statistics
  • Visitors today : 8
  • Page views today : 9
  • Total visitors : 11,786
  • Total page view: 12,651
svg+xml;base64,PHN2ZyB2aWV3Qm94PScwIDAgMSAxJyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnPjwvc3ZnPg== - URL Rewrite - Redirect http to https in IIS
Facebook Twitter Instagram YouTube LinkedIn
  • Donation ❤️
  • About
  • Services
  • Submit Tutorials
  • Contact Us
  • Privacy Policy
  • Terms of Use
Copyright © 2017- 2022 by Zoomtutorials.com. All Rights Reserved. Designed with ❤️ by CloudSols.com

Type above and press Enter to search. Press Esc to cancel.

wpDiscuz