Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

 Windows OS Hub / Windows Server 2019 / Redirect HTTP to HTTPS in IIS (Windows Server)

September 7, 2023 Windows 10Windows Server 2016Windows Server 2019

Redirect HTTP to HTTPS in IIS (Windows Server)

Once you have installed an SSL certificate installed on IIS website, you will need to configure a rule to automatically redirect all incoming unsecure HTTP requests to HTTPS URLs.

To create redirection rules in IIS, you must download and install the URL Rewrite Module 2.1 IIS module (https://www.iis.net/downloads/microsoft/url-rewrite).

Then open the Internet Information Services Manager console (InetMgr.exe) and select your site.

Go to the SSL Settings section and make sure that the Require SSL option is not enabled. If not, this will cause a conflict with the Rewrite URL redirect rule resulting in 403.4 forbidden errors.

Do not enable SSL on IIS

Then go to the URL Rewrite section.

Install URL rewrite module on IIS on Windows

Select Add Rule -> Blank rule.

Specify the rule name and configure the following parameter values:

  • Requested URL -> Matches the Pattern
  • Using -> Wildcards
  • Pattern -> *

Create rewrite rule to redirect from HTTP to HTTPS

In Conditions, change Logical Grouping to Match All and click Add. Configure the options:

  • Condition input -> {HTTPS}
  • Check if input string -> Matches the Pattern
  • Pattern -> OFF
  • Ignore case: enabled

HTTPS redirect rule on IIS

Now move on to the Action section and set:

  • Action Type -> Redirect
  • Redirect URL -> https://{HTTP_HOST}{REQUEST_URI}
  • Redirect type -> Permanent (301)

Create permanent redirect (301) to HTTPS on IIS

Once the redirect rule is created, you will need to reset IIS with the following command:

iisreset

iisreset

Open your browser and try to access your website using the HTTP address. You should be automatically redirected to the HTTPS URL.

check HTTP to HTTPS redirect

You can also manually enable the HTTP-to-HTTPS redirection IIS rule in the web.config file:

<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="rewrite_rule_Redirect_HTTP_to_HTTPS" patternSyntax="Wildcard" stopProcessing="true">
           <match url="*" />
              <conditions>
                <add input="{HTTPS}" pattern="OFF" />
             </conditions>
           <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

This HTTP to HTTPS redirect rule in IIS will work on the current versions of Windows Server 2022, 2019, 2016, and Windows 10/11.

0 comment
2
Facebook Twitter Google + Pinterest
previous post
Add an Additional Domain Controller to an Existing AD Domain
next post
How to Create UEFI Bootable USB Drive to Install Windows

Related Reading

How to Connect VPN Before Windows Logon

November 14, 2023

Using WPAD (Web Proxy Auto-Discovery Protocol) on Windows

November 7, 2023

Zabbix: How to Get Data from PowerShell Scripts

October 27, 2023

Tracking Printer Usage with Windows Event Viewer Logs

October 19, 2023

How to Use Ansible to Manage Windows Machines

September 25, 2023

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMWare
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • How to Connect VPN Before Windows Logon

    November 14, 2023
  • Removing Azure Arc Setup Feature on Windows Server 2022

    November 9, 2023
  • Using WPAD (Web Proxy Auto-Discovery Protocol) on Windows

    November 7, 2023
  • Send Emails with Microsoft Graph API and PowerShell

    November 6, 2023
  • Zabbix: How to Get Data from PowerShell Scripts

    October 27, 2023
  • Tracking Printer Usage with Windows Event Viewer Logs

    October 19, 2023
  • PowerShell: Configure Certificate-Based Authentication for Exchange Online (Azure)

    October 15, 2023
  • Reset Root Password in VMware ESXi

    October 12, 2023
  • How to Query and Change Teams User Presence Status with PowerShell

    October 8, 2023
  • How to Increase Size of Disk Partition in Ubuntu

    October 5, 2023

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • How to Allow Multiple RDP Sessions on Windows 10 and 11
  • How to Repair EFI/GPT Bootloader on Windows 10 or 11
  • How to Restore Deleted EFI System Partition in Windows
  • Network Computers are not Showing Up in Windows 10/11
  • How to Run Program without Admin Privileges and Bypass UAC Prompt
  • Fix: BSOD Error 0x0000007B (INACCESSABLE_BOOT_DEVICE) on Windows
  • Fixing ‘The Network Path Was Not Found’ 0x80070035 Error Code on Windows
Footer Logo

@2014 - 2023 - Windows OS Hub. All about operating systems for sysadmins


Back To Top