Question

I need to create a site collection so that url looks like http://hr.mycompany.com instead of http://portal.mycompany.com/hr. How do I do that?

Was it helpful?

Solution

What you're looking for is the host named site collection, which enables you to assign a unique DNS name to site collections. Or alternatively create an AAM for existing Site collection to achieve it. For example, you can address them as http://hr.mycompany.com or http://sales.mycompany.com.

The sample PowerShell code creates a new web application listing on port 80, and two host named site collections that use the Publishing Portal site template.

  1. Create a web application to host your host-named site collections

    $w = New-SPWebApplication -DatabaseName "WSS_Content" -ApplicationPool "SharePoint - Content App Pool" -Name "HostNameTest" -Port 80

  2. Perform an IIS reset

    IISRESET /noforce on each server before using the new web application

  3. Create a root site collection

    This is required for Search crawling content. For more information, see: http://technet.microsoft.com/en-us/library/cc424952.aspx#section2b

    $webAppUrl = "web application url" #ex: http:// sharepointserver

    New-SPSite $webAppUrl -OwnerAlias "SP\someusername" $w -Name "RootSC"

  4. Create your site collections

    $w = Get-SPWebApplication "HostNameTest"

    New-SPSite http://hr.mycompany.com -OwnerAlias "SP\someusername" -HostHeaderWebApplication $w -Name "HostA" -Template "BLANKINTERNETCONTAINER#0"

    New-SPSite http://sales.mycompany.com -OwnerAlias "SP\someusername" -HostHeaderWebApplication $w -Name "HostB" -Template "BLANKINTERNETCONTAINER#0"

So, you will have a web application with two two host-named site collections.

If SSL is a requirement, you can also create the web application and the host-named site collections using https (ex: port 443). But you will need to buy a wildcard certificate or a SAN certificate for *.mycompany.com. Also note that SSL is a requirement for certain features of SharePoint 2013.

To find more information:

OTHER TIPS

You need to create a new web application and specify this as the URL, yes you could use an existing site collection an extend it using AAM but if you are starting from scratch a new web app and site collection is best.

Thanks

Matt

Specify the host header what you want it to look like while creating new web application. or you can always use Alternate access mapping to look like http://hr.mycompany.com.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top