Thursday, December 11, 2014

SharePoint 2013: Host-named site collections

With SharePoint 2013 it is possible to use host-named site collections. It's pretty cool and might shorten a lot of domains companies use internally for their business units. In SharePoint 2010 the feature was only available for web applications.

To create a host-named site collection (HNSC) you have to use PowerShell:
New-SPSite "http://example.contoso.com" –OwnerAlias “contoso\OWNER" –HostHeaderWebApplication "http://portal.contoso.com" –Name "Example" -Description "Exampleportal" -Template “STS#0” -language 1033

With this you create the site collection "Exampleportal" within the web application "http://portal.contoso.com". Of course you have to create a DNS entry for this new HNSC.

You might want to use this with a managed path. First we need a new managed path
New-SPManagedPath 'businessunits' -HostHeader

Now you can create your site collection:
New-SPSite "http://example.contoso.com/businessunits/example" –OwnerAlias “contoso\OWNER" –HostHeaderWebApplication "http://portal.contoso.com" –Name "Example" -Description "Exampleportal" -Template “STS#0” -language 1033

If you want to move existing site collections from path-based site collections to HNSC you will have to backup your site collections and restore it at a new collection.

No comments:

Post a Comment