IT Nota

  • Home
  • How To
  • .NET
  • WordPress
  • Contact
You are here: Home / How To / How to Force HTTPS in IIS

How to Force HTTPS in IIS

This is a short tutorial on how to force an HTTPS connection to your website in IIS. The way we do it is by adding a URL Rewrite rule that will redirect any unsecured incoming traffic to HTTPS.

Steps

  1. The first step you need to check is if you have URL Rewrite module installed. If you don’t have it installed, you can download it from the link at the bottom of this post.

  2. You can either use the GUI on IIS to set this up, or apply the rules in web.config file of your website. You just need to substitue the target URL with your own.

  3. Open your web.config in a text editor and add the rewrite rule inside the system.webServer child element:

    <system.webServer>
      <rewrite>
        <rules>
          <rule name="Force HTTPS" enabled="true" stopProcessing="true">
            <match url="(.*)" />
            <action type="Redirect" url="https://www.itnota.com" />
            <conditions logicalGrouping="MatchAll">
              <add input="{HTTPS}" pattern="^OFF$" />
            </conditions>
          </rule>
        </rules>
      </rewrite>
    </system.webServer>
    

    Or if you use IIS GUI, it should look something similar to this:

    IIS Rules using URL Rewrite to force HTTPS connection

That’s all there is to force HTTPS connection to your website. In this day and age, this should be the minimum setup for any websites.

Download

URL Rewrite

June 1, 2022 Filed Under: How To Tagged With: IIS, Internet Information Services, Microsoft

Buy me a coffee?

Buy me a coffee If you find any of the articles or demos helpful, please consider supporting my work here, you'll have my big thanks!

Leave a Reply Cancel reply

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

Buy me a coffee Support this site
Buy Me a Coffee?

Categories

  • .NET
  • Coding
  • Cybersecurity
  • Database
  • How To
  • Internet
  • Multimedia
  • Photography
  • Programming
  • Resources
  • Review
  • Tips and Tricks
  • Uncategorized
  • Use Case
  • WordPress
  • Writing

Recent Posts

  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database
  • How to Install Cryptomator on macOS
  • How to Turn On Advanced Data Protection for iCloud
  • How to Create SSH Keys

Recent Posts

  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database
  • How to Install Cryptomator on macOS
  • How to Turn On Advanced Data Protection for iCloud
  • How to Create SSH Keys

Tags

.NET ASP.NET Cdonts Dll Classic ASP Code Editor ETL FSharp Genesis Framework Git Google HP Asset Manager HTML5 Hugo IIS Information Security Internet Internet Information Services iOS JAMStack JavaScript Linux macOS Microsoft Microsoft SQL Server MVC PHP PowerShell Python Simple Mail Transfer Protocol Smtp Server SQL SQL Server SSIS SSMS SSRS Sublime Text Visual Studio Visual Studio Code VPN Web Server Windows Windows 8 Windows 10 Windows 2012 Windows Server

Copyright © 2011-2023 IT Nota. All rights reserved. Terms of Use | Privacy Policy | Disclosure