SharePoint 2016/2013 Administration - How To Create Host Header Site Collections

A host-named site collection allows you to address a site collection with a unique DNS name.

SharePoint decides the mapping of the host nName with the Site Collection at the time of initializing SPSite Object. During the initialization process, SharePoint queries SPWebApplication object to see if host header details are associated with the Site Collection and if there is no information returned on host headers, then it becomes evident that this is a typical Site Collection.

If we inspect the ULS logs for Site Collections with host headers, we will see the entries like Site lookup, which has found the host header site. On the other hand, if we inspect the same logs for Site Collections without host headers looking up the additional information about the typical site http://serverName:Port/sites/site001

In this article, we will look into the steps to create host header based Site Collections, as per the process given below.

1

Step 1

Add DNS entry
  • Search for DNS on Windows Server.

    2
  • Select the domain name.
  • Right click and select New Host.

    3
  • Enter new host name.
  • Enter IP address of the Hosting Server.
  • Click Add Host.

    4

This will add a new host name entry in the DNS Catalog.

5

Step 2

Create Site Collection

Since we don’t have Web UI available to create the host header based Site Collections, so the only option with which we are left with is PowerShell only.

PowerShell command, which we can use to create a host header based Site Collection is given below.

  1. New-SPSite “http://developerWorkspace001.PRASHANT.LOCAL”; -HostHeaderWebApplication “http://developmentportal.prashant.local:2016”; -Name “Developers Workspace 001” -OwnerAlias “Prashant\Administrator” -Template “DEV#0”  

In this command, we have the parameters and their values given below.

1.1.png

Once you execute PowerShell, we can see the output given below.

6

We can verify the creation of the new host header Site Collection by going to Central Administrator -> Application Management -> View All Site Collections7

Step 3

Add Site Binding

PowerShell command is given below, which we can use to Add the Site Binding in IIS.

  1. New-WebBinding -Name “Development – Portal” -IPAddress “*” -Port 2016 -HostHeader “developerWorkspace001.PRASHANT.LOCAL”  

In this command, we have the parameters and their values given below.

2.1

Once PowerShell executes successfully, we can see the output given below on the command prompt.

8

We can verify the creation of Site Binding in the IIS by using the steps givenn below.

  • Search for IIS on Windows Server.

    9
  • Select the Web Application and click Bindings Links, as shown below.

    10
  • On the Site Bindings Window, we can see a new Site Binding is added to IIS.

    11
  • Select Site Binding and click Edit button to open Edit Site Binding Window.

    12

This shows that binding is created successfully.

Now, lets visit the host header Site Collection by visiting the URL given below.

http://developerWorkspace001.PRASHANT.LOCAL

Enter the credentials when it asks.

13
The screenshot given below pops up.

14

Hope, you found it helpful.