There was a problem loading the comments.

How to Redirect HTTP to HTTPS in IIS?

Support Portal  »  Knowledgebase  »  Viewing Article

  Print

Enforcing HTTPS is essential for securing your website and improving SEO rankings. In Internet Information Services (IIS), you can configure an automatic HTTP to HTTPS redirect using built-in tools or the web.config file.

 

This guide works for IIS 7, IIS 8, IIS 10, and later versions.


🔧 Prerequisites

  • A valid SSL certificate installed and bound to your site in IIS.

  • Administrator access to the server and IIS Manager.


✅ Method 1: Redirect HTTP to HTTPS via IIS GUI

Works well for simple sites or when you prefer a graphical interface.

  1. Open IIS Manager

    • Press the Windows key, type inetmgr, and press Enter.

  2. Select Your Site

    • In the Connections panel (left side), expand Sites and click your site name.

  3. Install HTTP Redirect Feature (if not already installed)

    • Open Server Manager → go to Add Roles and Features.

    • Under Web Server (IIS) > Web Server > Common HTTP Features, make sure HTTP Redirect is selected.

  4. Open HTTP Redirect

    • In Features View, double-click HTTP Redirect.

  5. Enable Redirect to HTTPS

    • Check “Only redirect requests to content in this directory (not subdirectories)”.

    • Enter your HTTPS URL (e.g., https://www.example.com).

    • Check both:

      • “Only respond to requests to this site”

      • “Status code: 302 Found” (or change to 301 for permanent redirect).

  6. Apply the Settings

    • Click Apply in the Actions pane.


✅ Method 2: Redirect via web.config File (Recommended for Developers)

Ideal for permanent redirects and version control.

  1. Open your site’s web.config file (located in the website’s root directory).

  2. Add the following inside <system.webServer>:

<rewrite>
  <rules>
    <rule name="Redirect to HTTPS" stopProcessing="true">
      <match url="(.*)" />
      <conditions>
        <add input="{HTTPS}" pattern="off" ignoreCase="true" />
      </conditions>
      <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
    </rule>
  </rules>
</rewrite>
  1. Save the file and reload the site in your browser to test.

🧠 Note: Requires URL Rewrite Module installed. You can download it from the Microsoft IIS site.


🔁 How to Install the URL Rewrite Module (if needed)

  1. Download from: https://www.iis.net/downloads/microsoft/url-rewrite

  2. Run the installer and restart IIS Manager.

 


Share via
Did you find this article useful?  

Related Articles

Tags

© Softsys Hosting