Creating Host-Named Site Collections in SharePoint 2013

shareqlfb2

Host-Named Site Collection (HNSC) is actually a means to have a separate DNS for each site collection rather than having all the site collections follow the URL of the web application (path-based site collections).

Host-named site collections are the preferred method to deploy sites in SharePoint 2013 and many features (like Apps) are optimized for HNSC.

For instance if I want to create 3 site collections, I can now have dedicated URLS :

Microsoft recommends this by default and makes use of it in Office 365; as far as I know all site collections we create in Office 365 are Host-Named Site Collections (HSNC). It is fully tested by millions of customers every day : –)

  • The main reason for that is that HNSC make your farm design simpler to design, to setup and to operate.
  • Another reason is that since resources are not used to support multiple application pools and web applications, the farm will be more stable.
  • …and another obvious reason is that since less/no custom code (that can potentially harm the farm) is used in SharePoint 2013, there is also less risk that a single application pool get corrupted. In O365, only Apps or sandbox code (deprecated) is tolerated.

A SharePoint 2013 KISS design (Keep it Simple, Stupid) today means : 1 farm, 1 web app, HNSC and 1 zone.

  • 1 farm : I still have to find real projects where my custom needs several farms.
  • 1 web app : even the MySites can be hosted with other SharePoint Sites
  • 1 zone :You can implement multiple authentication providers on a single zone but you need at least the Windows Authentication (NTLM) provider on the default zone (for the crawler, more details later).

Host Name Site collections are hosted in web applications that don’t have host headers.

ok hands-on now :

Step 1. Create a hosting web application without any host header and preferably on port 80.

image

This means that we will now avoid host header binding in IIS and responsible for resolving the correct site for the address based upon the incoming request passed through IIS.You MUST avoid host header in the “host” web app.

Step 2. In this Web App, we have to create a “normal” site collection

image

 

Step 3. Create DNS entries

image

Let’s go to the DNS server and create a new A Host with the portal.contoso.com FQDN and pointing to the web front end

image

 

Step 4. Create the Host Named Site Collection http://portal.contoso.com

 

In SP2013, HSNC can only be created via the New-SPSite PowerShell command; the –HostHeaderWebApplication option specifies that we are creating an HSNC and provides the link to the corresponding webapplication.

Let’s type the following command:

New-SPSite ‘http://portal.contoso.com’ -HostHeaderWebApplication ‘http://eurosp/’ -Name ‘Portal’ -Description ‘Customer root’ -OwnerAlias ‘contoso\administrator’ -language 1033 -Template ‘STS#0’

 

image

 

Even if HNSC can only be created via PowerShell, they can be managed from Central Administration like other site collections. For instance, our newly created HSNC will show up in the Site Collection list (Central Admin) :

image

Step 5. Managed Path for HNSC

http://portal.contoso.com/teams/SPGovernance and http://portal.contoso.com/projects/SPPoc

(we can add more HNSC like a HNSC for the Search center, another one for the MySites,…)

Since there will be several sites collections under  http://portal.contoso.com/teams/  and http://portal.contoso.com/projects/ we have to rely on implicit Managed Path

Creating Managed path for HNSC can be done with the New-SPManagedPath Powershell command.

Let’s type :

New-SPManagedPath ‘teams’ –Hostheader

New-SPManagedPath ‘projects’ –Hostheader

 

image

Step 6. Creating Hosted-Named Site Collections

let’s create our 2 site collections:

New-SPSite ‘http://portal.contoso.com/teams/SPGovernance’ -HostHeaderWebApplication ‘http://eurosp/’ -Name ‘SharePoint Governance team’ -Description ‘SP governance team’ -OwnerAlias ‘contoso\administrator’ -language 1033 -Template ‘STS#0’

New-SPSite ‘http://portal.contoso.com/projects/SPPoc’ -HostHeaderWebApplication ‘http://eurosp/’ -Name ‘SharePoint Proof of concept’ -Description ‘SharePoint Proof of concept’ -OwnerAlias ‘contoso\administrator’ -language 1033 -Template ‘STS#0’

image

Now, 3 important remarks :

  1. The maximum number of Managed paths for HNSC : 20 for the whole farm !  (yes only 20!)
  2. You cannot list HNSC with managed Path in Central Administration.
  3. The equivalent of alternate access mapping cannot be applied to HSNC with Managed path as described below

Step 7. URL Mapping and Hosted-Named Site Collections

if for instance, we want the url http://contosointranet to be mapped to an existing url like http://portal.contoso.com but in a different zone, we can use something similar to what Alternate Access mapping provides (but focused on Hosted-Named site collections) :

Url Mapping.

Here again, we need to rely on PowerShell :

set-SPSiteUrl

Let’s create a contosointranet.contoso.com DNS entry

 image

Type :

Set-SPSiteUrl (Get-SPSite ‘http://portal.contoso.com/’) -Url ‘http://contosointranet.contoso.com’ -Zone Intranet

image

…and the portal can be reached via http://portal.contoso.com or via http://contosointranet.contoso.com

As mentioned before, url mapping cannot be applied to HSNC with managed path : for instance we cannot map http://governance to http://portal.contoso.com/teams/spgovernance

Since we are mentioning zones, don’t forget that the default zone url must be always used by the crawler (and with windows authentication, not claim authentication); this is not clearly documented in the TechNet except here. if you don’t do this you might face issues with the Query search results (operated from from other zones).

3 responses to “Creating Host-Named Site Collections in SharePoint 2013

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s