Redirect HTTP to HTTPS on Windows IIS — Forced HTTPS

Yst@IT
3 min readMar 22, 2021

In my previous blog, I have SSL Certificate related setting done and IIS running with both HTTP and HTTPS. There are times where we want to make sure all traffics are using HTTPS, so we must redirect HTTP traffics to HTTPS.

In order to do so, we need to:

  1. Install rewrite module on IIS
  2. Configure HTTP to HTTPS rules
  3. That’s it and verify!

Let’s get started

Install rewrite module on IIS

Install rewrite modules from Microsoft’s website.

Redirect HTTP to HTTPS on Windows IIS — Forced HTTPS

File called urlrewrite2.exe is downloaded, execute it.

Redirect HTTP to HTTPS on Windows IIS — Forced HTTPS

Install through process as below.

Redirect HTTP to HTTPS on Windows IIS — Forced HTTPS

IIS rewrite module is done.

Redirect HTTP to HTTPS on Windows IIS — Forced HTTPS

Go back to IIS Manager and you shall see URL Rewrite feature as show below. If you do not see it, close IIS Manager and open it again.

Redirect HTTP to HTTPS on Windows IIS — Forced HTTPS

Configure HTTP to HTTPS rules

In order to forced HTTPS, we need to configure rewrite rules, start by clicking on URL Rewrite feature.

You can add rewrite rule on IIS Server or Web sites. If you configure on IIS Server, it means all Web sites under it will be affect where rule is only affected to particular Web site if you configure it on Web site level.

In my blog, I will configure on IIS Manager level.

Next, click Add Rule(s), follow by Blank rule, then OK below.

Redirect HTTP to HTTPS on Windows IIS — Forced HTTPS

Configure URL pattern to match rewrite rule.

Redirect HTTP to HTTPS on Windows IIS — Forced HTTPS

Configure matching conditions.

Redirect HTTP to HTTPS on Windows IIS — Forced HTTPS

Lastly, configure action for matched pattern.

Redirect HTTP to HTTPS on Windows IIS — Forced HTTPS

A finished view.

Redirect HTTP to HTTPS on Windows IIS — Forced HTTPS

Verification

Lastly, let’s access the website with HTTP and check if it is redirects to HTTPS! And succeed!!

Redirect HTTP to HTTPS on Windows IIS — Forced HTTPS

That’s it for this series. Hope you enjoy!

Series

Beginners for Windows — Install, Configure and Run IIS on Windows 2016
Create CSR, Apply SSL Certificate and Configure IIS Running on HTTS

Reference:

Redirect HTTP to HTTPS on IIS

--

--

Yst@IT

Cloud Solution Architect, focusing on Oracle Cloud Infrastructure currently.