Host named site collections in SharePoint 2013

What are HNSC

Traditional site collections that we create in SharePoint are Path based site collections


Host named site collections have their own url. 


Microsoft recommends using host named site collection.  It is used in SharePoint online and Office 365.

Benefits of HNSCs

A SharePoint farm can have 20 web applications at max.  If we use path based site collections in order to have unique urls we need to create different web applications with different host names.

For example if we need to create following site collections




By using path based site collections we need to create 3 web application with appropriate host names. 

But by using host named site collections we can create one web application and 3 site collections with different urls.

Path based site collection are not scalable as we can create at max 20 web applications, while a sharePoint farm can have at max 250000 site collections using shared content database.

When to use Path Based site collections

1. You want separate application pools.

2. You have requirement of self service site creation feature. - You need to use a custom solution for self-service site creation with host-named site collections.

How to create HNSC

HNSC can be created only through powershell script

  1. Create web application
  2. Create root site collection (required for crawling)
  3. Create host named site collections
  4. Set alternate URLs for host named site collection

Let us have a closer look.

  • Create a web application (either through central admin or through powershell). 

I created through central admin

port – 100

Web app name – SharePoint – 100

  • Now create a root site collection.  When root site collection is crawled, all HNSC s also get crawled although they do not appear in content sources

New-SPSite 'http://<servername>:100' -Name 'Root Portal' -Description 'Root site collection' -OwnerAlias 'contoso\administrator' -language 1033 -Template 'STS#0'

  • Now create HNSC.  Use following powershell to create HNSC

New-SPSite '' -HostHeaderWebApplication 'http://<servername>:100’ -Name ‘CompanyA portal’ -Description 'Portal for CompanyA' -OwnerAlias 'contoso\administrator' -language 1033 -Template 'BLANKINTERNET#0'

New-SPSite '' -HostHeaderWebApplication 'http://<servername>:100’ -Name ‘CompanyB portal’ -Description 'Portal for CompanyB' -OwnerAlias 'contoso\administrator' -language 1033 -Template 'BLANKINTERNET#0'

Managed paths with host-named site collections

Managed paths can be used with host-named site collections.  Managed paths for HNSC are different from path based site collections.  Managed paths for HNSC are available to all HNSCs in the farm regardless of the web application.  They are limited to 20 per farm.  While managed paths for path based site collection do not apply to path based site collectioins in other web applications. 

To create managed path for HNSC we need to use powershell

New-SPManagedPath ‘dept’ –HostHeader

Now we can create HNSC with managed path

New-SPSite ‘’ –HostHeaderWbApplication ‘http://<servername>:100’ –Name ‘Technology’ –Description ‘Technology department’ –OwnerAlias ‘contoso\administrator’ –language 1033 –Template ‘BLANKINTERNET#0’

Managed path for path based site collection can be defined at central admin or using powershell

New-SPManagedPath [-RelativeURL] "</RelativeURL>" -WebApplication <WebApplication> creates managed path for a particular web application that can be used by path based site collections of that particular web application

Having done this you can check by browsing the site

Note : – In case you see a 404 error and if you are browsing the site on same local SharePoint server, you would need to change the host file to include then entry

for example to browse the entry in host file would be

Further you need to disable LoopBack in registry.  To do this manually open registry using regedit and nav to HKEY_LM\System\CCS\Control\LSA

Create dword key with name ‘DisableLoopbackCheck’.  Change the value to 1 for this.

It can also be done using powershell

New-ItemProperty HKLM:\System\CurrentControlSet\Control\Lsa -Name "DisableLoopbackCheck" -Value "1" -PropertyType dword

Comments (15)

  1. gpdavis says:

    I am getting a url parsing error in powerscript when I try to create my host named site collections. I am trying to create 2 site collections for 1 web application. I want the site collections to have different domains. I see in your example you do something similar ( and Am I having some kind of DNS problem?

  2. Deepa Lakhani says:

    Yes you should be able to do it.  In case you are copying the script from the post make sure you replace the quotes with proper quotes from the above script.  I don't think it is any kind of DNS problem.

  3. gpdavis says:

    Thanks. So before I celebrate let me be clear about what I'm doing and ask a couple of questions:

    1. installed sharepoint foundation 2013. Your insructions say to create a root site collection before creating the host named sites. However, I read that the sharepoint foundation 2013 install creates the default web application and site collection.I see that a sharepoint-80 web app was created by the install but when I try to list the site collections nothing is listed. What confuses me is that I can access what looks to be a default web site named "Home" by putting http://<servername&gt; in my browser. I thought that would only happen if I had a site collection? So, do I already have a root site collection created by the install?

    2.When you mean proper quotes you mean " instead of the '?


  4. gpdavis says:

    So, I executed the command with the " and it seems to have worked. However, I mistyped one of the urls I created. How do I fix that?


  5. gpdavis says:

    I was able to delete and recreate the mistyped site collection. I can see my new site collections in central admin. However, when I put the urls in the server browser, I don't see any of the sites exept for the root site.

    Any help would be appreciated.


  6. Deepa Lakhani says:

    What error do you get?  Also don't forget to add host entry in the host file.  Also if you are browsing site from the same sharepoint server (which I guess you are) add a loopback entry.  Have mentioned in the end of blog.  If you cannot see any error, install and check on fiddler to check actual error.  

  7. gpdavis says:

    I put the urls in my hosts file and disabled loopback. On the server I get, " you may be trying to access this site from a secured browser. Enable scripts and reload this page". From one of my client laptops I get "Sorry, We could not find "URL" . It may be unavailable or may not exist…"

  8. gpdavis says:

    Update: I can see the sites on the server after adding them to trusted sites. However, can't see them anywhere else including computers on the same network.

  9. Deepa Lakhani says:

    To see them on other computers on the same network you need to add host entry in the host file of that computer

    Instead of, you should put the ip address of the web front end server.

  10. gpdavis says:

    Thanks. I think my next question may be a dumb one, but how do I make my sites accessible remotely or maybe the correct term is publicly on computers outside the network? Let me give you a little background.

    I am using windows home server 2011. I know it is no longer supported, but I still use it because  it still does everything I need without having to learn all the ends and outs of server administration (at least until now). The server came with a default web site and domain name ( that gives me remote access to the server. This site resides on port 80 and 443. To get share point to work, I removed the IIS bindings to port 80 for the home server default site. Now, I can reach my share point default site remotely on port 80 by going to http://x.home and I can reach the home server default site by going to on port 443.

    I started down the road of host named site collections because I want to make them accessible remotely or publicly without using the x.home domain name. However, I am starting to think that I am missing an important piece to making this work..

    Sorry for the long reply and thanks for your help.

  11. Travis says:

    Great article.  Couldn't be more clear.  Thanks for posting it.

  12. Mike says:

    Just a bit of an FYI regarding creating host-named site collections using SharePoint Online. I have been finding lots of conflicting information about this so finally called MS Support. Just got off the phone with them in fact. Their official word is: Creating host-named site collections is NOT an option using SharePoint Online (aka SharePoint 2013 Online, aka SharePoint 365). So the statement early in this post about it being "used in SharePoint online and Office 365" is only half right 😉

  13. TN says:

    First site collection has been created successfully:

    New-SPSite ‘…/Technology’ …

    Second one failed:

    New-SPSite ‘…/Technology’ …

    Question: Can we use the same SP2013 managed path to create multiple site collections (as above)? Thanks.

  14. Pn says:

    I tried the same Powershell script the Site collection is created but getting an error page can't be displayed while trying to run the site collection.Can you help me with this.?

    1. Make sure you have disabled loop back with this command
      New-ItemProperty HKLM:\System\CurrentControlSet\Control\Lsa -Name “DisableLoopbackCheck” -Value “1” -PropertyType dword

      Further if you still get error add a DNS entry or for a dev machine you can add an entry in host file

Skip to main content