Redirect from HTTP to HTTPS in SharePoint using IIS URL Rewrite Module

How to redirect HTTP to HTTPS in SharePoint?

Changing the SharePoint site from HTTP to HTTPS is a common requirement. URL rewrite module is a great plugin for IIS to achieve various sort of redirects in your SharePoint site (or any web site technically!). Let’s see how to implement HTTP to HTTPS redirect with IIS URL Rewrite Module.

Assuming you have an SSL certificate for your website imported in IIS and 443 Binding is added. Also, you have AAM Entry for HTTPS!

Prerequisites: Download and Install URL Rewrite module

As a prerequisite, you need to have the URL rewrite module added to your web server. If it’s already installed in your web server, you’ll find the “URL Rewrite” module icon below.

convert http to https sharepoint 2013

If it’s not installed already, Go to https://www.iis.net/downloads/microsoft/url-rewrite download and install the URL rewrite module. Let’s configure the URL to redirect to change the SharePoint site from HTTP to HTTPS.
change sharepoint site from http to https

Configure HTTP to HTTPS Redirect using URL Rewrite

  • Open IIS >> Select your web site from Sites node >> Open URL Rewrite module. 
  • Click on the “Add Rules” link in
    the Actions menu and then select “Blank” inbound rule template. 
    sharepoint 2013 redirect from http to https
  • Provide a Name to the Rule. Say: “Redirect HTTP to HTTPS”. Under “Match URL” Section: Set
    how to redirect http to https sharepoint 2013
    • Requested URL: Matches the Pattern
    • Using: Regular Expressions
    • Pattern: (.*)
  • Under “Conditions”, Click on the “Add” button to add a new condition
    how to change http to https in sharepoint
    • Condition Input: {HTTPS}
    • Check if input string: Matches the Pattern
    • Pattern: ^OFF$
      redirect http to https in sharepoint 2013
  • In Action Type Section, Set the following:
    sharepoint 2013 http to https url rewrite
    • Action Type: Redirect
      Redirect URL: https://{HTTP_HOST}/{R:1}
      Redirect Type: Permanent (301)
  • Click “Apply” from actions panel to save your changes!That’s all. This converts http to https in SharePoint 2013.

These changes create the below entries in web.config file of the website.

      <rewrite>
            <rules>
                <rule name="Redirect HTTP to HTTPS" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="^OFF$" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" />
                </rule>
            </rules>
        </rewrite>

Now, when a user hits any HTTP link on your site, the URL rewrite module redirects them to HTTPS of the same link!

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

2 thoughts on “Redirect from HTTP to HTTPS in SharePoint using IIS URL Rewrite Module

  • In SP2013 We have a host named site collection called https://abc.com under a webapp named https://xyz.com. Now my question is, can I create a new webapp with same url as my host named site collection i.e. https://abc.com. Please note that the host site is in https and the webapp that I want to create will be with http. URL should remain same. Is it possible?

    Business Requirement for above question: Actually we have a HNSC which is in https but it’s webapp is http. But users type http itself for browsing that HNSC which throws error. Basically what we want is that even if users try browsing hnsc with http, they should be redirected to https. I don’t think url redirect will help just for one https hnsc when the webapp belongs to http. So I am thinking to create a new webapp with same url but with http. And then I will put a redirection code on its homepage to go to that https HNSC. That is why I have asked if we can have 2 similar urls

    Reply
  • FYI old post but maybe applicable. Adding this url rewrite unfortunately breaks users who use Outlook to sync to SharePoint calendars. When a user first connects to a SharePoint Calendar via outlook, the initial events are synced over sps protocol, however, future syncs are done via http/https and http 301 redirects are not supported over https in Outlook (apparently) and you will error with 301 in outlook log….

    Reply

Leave a Reply

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