Host-Named Site Collections in SharePoint

A host-named site collection allows you to address a site collection with a unique DNS name, such as “http://collection1.com”. Typically, you create a SharePoint web application that contains many path-based site collections sharing the same hostname (DNS name). For instance, collection1 may be at “http://mywebapp.com/sites/collection1” and collection2 at “http://mywebapp.com/sites/collection2”. These are referred to as path-based site collections and are recommended for most corporate scenarios.

Host-named site collections enable assigning a unique DNS name to site collections. For example, you can address them as http://collection1.com and http://collection2.com, which allows hosters to scale to many customers.

How Host-Named Site Collections Work?

SharePoint determines how to map the hostname to the site collection when constructing the SPSite object. It uses the SPWebApplication object internally to find the web application in the configuration database and determine if a host header is associated with the site collection. If no host header information is returned, it is considered a typical site collection.

Creating a Host-Named Site Collection

To create a host-named site collection, you can use the following PowerShell command.

New-SPSite 'http://collection1.com' `
    -HostHeaderWebApplication 'http://mywebapp' `
    -Name 'Demo' `
    -Description 'Demo' `
    -OwnerAlias 'domain\administrator' `
    -Language 1033 `
    -Template 'STS#0'

Advantages

  • The ability to use managed paths with host-named site collections.
  • The ability to use off-box SSL termination with host-named site collections.
  • Host-named site collections can be used to implement multi-tenancy solutions.

Limitations

  • Host-named site collections can only be created using PowerShell.
  • To create a host-named site collection with a URL the same as the web application, you must use the SharePoint UI.

For more insights and updates on SharePoint and IT solutions, feel free to connect with me on LinkedIn.