We had requirement in Office 365 to create site collection with friendly URL.
Before we move to the solution, I would like to explain about Host-named site collections and Path-based site collections.
You may like:
Using Windows PowerShell script we can create hosted named site collection, which has to be assigned to unique DNS name.
Eg. In SharePoint Administrator when we create a new site the host URL will behttp://portal.Test.Com/sites/TeamA.So here the host is http://portal.Test.Comwhich has same DNS record for it. But what if we had to create sitecollection named ashttp:/hr.Test.com?
In SharePoint Administrator, we will not find any option to create hosted named site collection and as mentioned above we can using Windows PowerShell. So this is what we called Host-named site collections.
Path-based site collections is the regular way of creating sitecollection using SharePoint Administrator or Windows PowerShell.
In Path based the sitecollection URLS will be http://portal.test.com/sites/site1 ,http://portal.test.com/sites/site2 etc.
All the site collections will have same host name and DNS name as per the web application.
Now we have little bit of understanding about Host-named site collections and Path-based site collections.
Below Windows PowerShell script can be used to create Host-named site collections.
New-SPSite http://hr.test.com –OwnerAlias “Test\sam” –HostHeaderWebApplication http://portal.tes.com –Name “Sam Site” -Template “STS#0”
Now the site is created and we need to have DNS record entry for the same. The DNS record will be pointing to the place where SharePoint farm DNS entries are being maintained.
Hope this will be useful.