1

How make SharePoint root site collection subsites to redirect to https if user write http on the browser the scenario as following: After configure alternative access mapping from SharePoint and IIS: -If user write http://oursite.com it redirect to https://oursite.com -If user write http://oursite.com/subsite1 it does not not redirect to https://oursite.com/subsite1 so how Can I redirect the root site collection subsites to https

3 Answers 3

5

It's NOT preferred to install a write module on the webserver. instead, the redirect should happen on the load balancer itself.

In your case, ask your load balancer administrator to add a redirect rule to force redirect from HTTP to https for your domain and all URLs under this domain.

Make sure you have added the binding setting in IIS for port 80 and 443.

1

You can install the URL rewrite tool in the web front end server (IIS) and can write the basic rule to redirect to your desired URL.

You can download the URL Rewrite module from the below location:

Microsoft URL Rewrite Module 2.0 for IIS (x64)

Note:

  • The installation of URL rewrite tool in the web front end server (IIS) is recommended only when you have a three-tier server farm or Single stand-alone server.
    1. An Application Server,
    2. One Front End Server and
    3. A database server.

And also, you can configure the script editor web part in the home page your HTTP site can redirect to https site like below:

window.location.href = "https://siteURL";

or

window.location.replace("https://siteURL");
-1

The issue solved in root site collection subsites by adding the following jquery script to page using script editor or content editor web part:

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
  //**To run one time only if URL contain http**
 if (window.location.href.indexOf("http:") > -1) {

    window.location.replace("https://oursite.com/subsite1/SitePages/home.aspx");
  }
});
</script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.