Host Named Site Collections in SharePoint
What is Host Named Site collection?
Host-named site collections are the best option if you want to create multiple root-level site collections within a web application. (Or Unique URL for each site collection).
SharePoint supports both path-based & host-named site collections. The primary difference is: All path-based site collections in a Web application share the same host name (DNS name), where as each host-named site collection in a Web application is assigned with a unique DNS name.
In other words:
- Host-named site collections allow you to create many root-level host-named sites within a single Web application.
- With path-based sites, you are limited to a single root-level site collection within a Web application
What are the advantage/disadvantages of Path-Based vs Host Named Site Collections:
Path-Named: The major advantage of path-based sites is that these sites can be accessed from any zone that you configure. Also, the alternate access mappings feature, which provides support for SSL, works with all path-based sites. You are limited to a single root-level site collection within a Web application, But the managed paths option allows you to create top-level sites beneath the initial root-level site collection.
Host-Named: They give you more control over URLs. Host-named site collections are only available through the default zone. The alternate access mappings feature does not work. You can’t use both HTTP and HTTPS together. You can create up to 100,000 host-named site collections within a single IIS Web site. Another great advantage of HNSC is: You can use a single wildcard SSL certificate for your entire site collections. E.g. *.Company.com. could be used for sites such as Sales.Crescent.com or NA.Sales.Crescent.com, etc.
How to create a Host-Named site collection?
Host-named site collections can be only created by using Windows PowerShell only. To configure host-named site collections, here are the steps:
- Create a web application with out Host header (You can create using SharePoint Central Administration or with PowerShell New-SPWebApplication cmd-let)
- Create an blank root site collection in the web application (path based).
- Create new host named site collections using New-SPSite cmdlet and the -HostHeaderWebApplication parameter.
New-SPSite https://<URL-For-Site-Collection> -OwnerAlias Domain\username -HostHeaderWebApplication <Web-App-URL>
This creates a host-named site collection with the URL <URL-For-Site-Collection> in the SharePoint 2010 Web Application with the URL <Web-App-URL>.
stsadm -o renamesite -oldurl “https://intranet.crescent.com/” -newurl “https://portal.crescent.com”
Don’t forget to update IIS!
IIS Binding: If your web application for HNSC site collections listens to Port 80 without any host headers, then there is no need for creating IIS bindings explicitly! Otherwise, you’ll have to add the Host header URLs of Host Named site collections to the web application.
Its also possible to add site bindings from PowerShell. Here is the script:
Import-Module WebAdministration
New-WebBinding -Name "<Web Site Name in IIS>" -Port 80 -Protocol http -HostHeader "prod.crescent.com"
Here is how to create host named site collection in SharePoint 2013 using PowerShell: PowerShell to Create host named site collections in SharePoint 2013
IIS bindings are not the way to deal with SP.
what if you want to add another front-end server in SharePoint Farm?
what if at any stage you need to stop and re-start SP foundation web app service?