Windows OS Hub
  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux
  • Home
  • About

Windows OS Hub

  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux

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

September 7, 2023

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
4
Facebook Twitter Google + Pinterest
Windows 10Windows Server 2016Windows Server 2019
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 Restore Deleted EFI System Partition in...

March 11, 2024

How to Run Program without Admin Privileges and...

June 8, 2023

Fix: Remote Desktop Licensing Mode is not Configured

August 24, 2023

How to Install Remote Server Administration Tools (RSAT)...

March 17, 2024

Refresh AD Groups Membership without Reboot/Logoff

March 15, 2024

How to Find the Source of Account Lockouts...

March 12, 2024

Fix: BSOD Error 0x0000007B (INACCESSABLE_BOOT_DEVICE) on Windows

March 17, 2024

Managing Windows Firewall Rules with PowerShell

March 11, 2024

Leave a Comment Cancel Reply

join us telegram channel https://t.me/woshub
Join WindowsHub Telegram channel to get the latest updates!

Recent Posts

  • Map a Network Drive over SSH (SSHFS) in Windows

    May 13, 2025
  • Configure NTP Time Source for Active Directory Domain

    May 6, 2025
  • Cannot Install Network Adapter Drivers on Windows Server

    April 29, 2025
  • Change BIOS from Legacy to UEFI without Reinstalling Windows

    April 21, 2025
  • How to Prefer IPv4 over IPv6 in Windows Networks

    April 9, 2025
  • Load Drivers from WinPE or Recovery CMD

    March 26, 2025
  • How to Block Common (Weak) Passwords in Active Directory

    March 25, 2025
  • Fix: The referenced assembly could not be found error (0x80073701) on Windows

    March 17, 2025
  • Exclude a Specific User or Computer from Group Policy

    March 12, 2025
  • AD Domain Join: Computer Account Re-use Blocked

    March 11, 2025

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
  • Install and Manage Windows Updates with PowerShell (PSWindowsUpdate)
Footer Logo

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


Back To Top