locked
Redirect HTTP to HTTPS with Host Name Site Collections RRS feed

Answers

All replies

    • Marked as answer by star.wars Thursday, June 27, 2013 10:37 AM
    Thursday, June 20, 2013 2:36 AM
  • And if IIS configuration isn't available to you, you could always build a custom control that would check whether the page has been requested over HTTPS and redirect the user if necessary. Such check would require only few lines of code.

    w: http://blog.mastykarz.nl | t: @waldekm | c: http://mavention.codeplex.com | c: http://mavention.nl

    • Marked as answer by star.wars Thursday, June 27, 2013 10:37 AM
    Thursday, June 20, 2013 6:41 AM
  • This is not correct. You can't use URL rewrite with Host Named Site Collections in SharePoint. For URL rewrite to work you need to set bindings on web application which overrides Host Named Site Collection bindings in SharePoint (you have to chose either web application bindings or let SharePoint handle that).

    If you want to use URL Rewrite you need to create new Site in IIS7 which will listen on port 80 and rewrite URLs to port 443. This will create small overhead but you can save on resources by leveraging HNSC and have minimal number of web applications on the server.

    ----Edit on 1/16/2014-----
    I stand corrected. Above statement is NOT CORRECT. You can indeed perform HTTP to HTTPS URL rewrite with Host Named Site Collections (HNSC) quite elegantly. You do not need any additional web applications. In essence you can build you whole farm with single web app on IIS (well two, since second one would be used for SharePoint services). Below is the example where I created single URL rewrite rule which handles any new host name provided they use same domain name (i.e. xxxxx.domain.com). I have 20+ HNSCs in single web application and all of them are using URL rewrite.

            <rewrite>
                <rules>
                    <rule name="Redirect to HTTPS" stopProcessing="true">
                        <match url="(.*)" />
                        <conditions>
                            <add input="{SERVER_PORT}" pattern="443" negate="true" />
                        </conditions>
                        <action type="Redirect" url="https://{HTTP_HOST}.domain.com/{R:1}" />
                    </rule>
                </rules>
            </rewrite>

    You need to install URL rewrite plugin and configure binding the following way on your web app in IIS. This will allow rewrite to work and SharePoint will be able to handle hoast header bindings internally.



    • Edited by ihuter Saturday, January 17, 2015 1:13 AM
    Friday, December 6, 2013 3:26 AM
  • URL rewrite can be used to redirect all http traffic to https even with host named site collections.

    Example :

    web app url :  https://domain.com

    site collections URL : https://teamA.domain.com,  https://teamB.domain.com and so on...

    so here you can easily redirect http request to https using IIS rewrite Rule. but the important point here is you can't use http sites with that web app (IIS website)


    ja


    • Edited by Ja08 Wednesday, September 24, 2014 5:41 PM
    Wednesday, September 24, 2014 5:41 PM
  • Your screenshot of site bindings in IIS shows no hostname in the http binding. When I try to add this I am required to put a Host Name into IIS. Did you just erase this? Is that supposed to be the url to the web application?

    Thanks!


    Love them all...regardless. - Buddha

    Thursday, April 9, 2015 2:44 PM