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.
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.
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.
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. - Provide a Name to the Rule. Say: “Redirect HTTP to HTTPS”. Under “Match URL” Section: Set
- Requested URL: Matches the Pattern
- Using: Regular Expressions
- Pattern: (.*)
- Under “Conditions”, Click on the “Add” button to add a new condition
- In Action Type Section, Set the following:
- Action Type: Redirect
Redirect URL: https://{HTTP_HOST}/{R:1}
Redirect Type: Permanent (301)
- Action Type: Redirect
- 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!
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
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….