SharePoint Host Name Site Collection




SharePoint Supports Path based site collection and host based site collection.


In SharePoint 2010 and SharePoint 2013,  Central Admin doesn't have an option to create Host based site collection. It needs to be created using power shell scripts.

Following are powershell commands  used to create a HNSC.



$cred = get-credential 'sphost\administrator' // enter the password here
$adminMA = New-SPManagedAccount -Credential $cred
New-SPWebApplication -Name 'HostNameTest' -ApplicationPool "HostNameTest" -ApplicationPoolAccount $adminMA -Port 9001


$w = Get-SPWebApplication "HostNameTest"
 
New-SPSite http://HostA.SharePoint.com:9001 -OwnerAlias "sphost\administrator"    -HostHeaderWebApplication $w -Name "HostA" -Template "BLANKINTERNETCONTAINER#0"
New-SPSite http://HostB.SharePoint.com:9001 -OwnerAlias "sphost\administrator"    -HostHeaderWebApplication $w -Name "HostB" -Template "BLANKINTERNETCONTAINER#0"