Monday, 30 November 2015

SharePoint 2010/2013 Automatic redirect from http to https


IIS 7.0+ Microsoft URL Rewrite Module is not available by default, you must need to download and install on all SharePoint front end servers

in this example i am using url.

http://portal.eteam.local
https://portal.etam.local.


Microsoft URL Rewrite Module 

SharePoint Settings :

SharePoint Web application alternative access mapping must be configured properly for HTTP and HTTPS.
  1. open Central administration , 
  2. Click on application management 
  3. click on alternative Access mapping 
  4. select particular application
  5. please verify all the url for the web application


 

IIS Settings:

Open the IIS and Check the Web application binding should be done for HTTP and HTTPS

  1. Open the IIS 
  2. Select the Specific web  Application.
  3. right click and click edit binding



Modifying Web.Config

make sure make of copy of web.config before making any changes.
open the web.config and Find   </handlers>

after handler close tag add below lines of code 

        
  <rewrite>
    <rules>
      <rule name="HTTP to HTTPS Redirect" stopProcessing="true">
        <match url="(.*)" />
        <conditions>
          <add input="{HTTPS}" pattern="off" />
        </conditions>
        <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Found" />
      </rule>
    </rules>
  </rewrite>
make sure your rewrite tag ended before </system.webServer>

Save the Web.config.

Now if user browse the sharePoint Webpplication with HTTP it will automatically redirect to HTTPS