Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
add comment

3 Answers

up vote 8 down vote accepted

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:

share|improve this answer
    
Assaalamualaikum. Can you provide details on how to do this using AAM? –  Mitch Veeno Jun 30 '12 at 20:51
    
WSalam, before you plan to go ahead, you need to make sure that AAM is configured correctly. The reason is when SharePoint receives a request it will only use AAM to perform that URL resolution. So while it is necessary to make sure your hosts files, DNS, and IIS bindings are properly configured so that a web request can reach the SharePoint server, it is also necessary to configure the URLs in AAM to match. See the link to try it yourself: sharepoint.microsoft.com/blogs/fromthefield/Lists/Posts/… –  Falak Mahmood Jun 30 '12 at 22:21
add comment

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.

share|improve this answer
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.