Recently I faced an issue that I created for myself when attempting to convert a path based site collection (PBSC) to a host named site collection (HNSC)
The situation was such that my PBSC was named https://portal.contoso.com and it had been created the good ole fashioned way, via the GUI, then modify the Alternate access mapping to read https://portal.contoso.com versus https://SEVERNAME:PORT, where SERVERNAME was something like 2013appw2k12 and port was 35089 or something (https://2013appw2k12:35089).
The world was great, the pbsc worked, and what not, but now it was time to re-architect the SharePoint so that it could scale. It was time to use Host Named Site Collections (HNSC’s). After all, who wants to put all the company data in one database (prd_wss_content_portal2 or whathaveyou)? The grand plan was that each division would have it’s own site collection someday. Angels were singing and then….
What the H did I do wrong? <- – uses Arnold S. voice from Total recall and substitutes H for F, full clip here
Well, the first thing I did wrong was when I followed the advice given here https://thesharepointfarm.com/2015/02/quickly-migrate-sharepoint-path-based-host-named-site-collections/
And here http://www.toddklindt.com/blog/Lists/Posts/Post.aspx?ID=573, I added my own step of not using a new name….doh!
Rather than follow the advice and use a new name, I tried to convert https://portal.contoso.com from its pbsc state to an hnsc and use the same name,
So I erroneously did
$uri = New-Object System.Uri(“http://portal.contoso.com”)
$site = Get-SPSite http://portal.contoso.com
Then end result is a database that still contains the site; but it does not work as an HNSC and SharePoint can’t see the site in the DB, even though it is still there.
I found this out after running get-spcontentdatabase, after having mounted the database to the HNSC web application. In looking at the Manage Content Databases screen in Central Admin, it showed the database mounted, but the site count was a big fat scary zero!
To fix this, I dismounted the database and then remounted it to a newly created PBSC web application, using this DB when creating the PBSC.
I also made sure that in both cases the bindings in IIS were corrected.
If you follow the instructions the cake will turn out great
I followed the instructions and did something like this,
$site = Get-SPSite http://portal.contoso.com $uri = New-Object System.Uri("http://kickass.contoso.com") $site.Rename($uri)
And to get 100% success, I followed the instructions to force the Content Database to refresh its site map with this:
Then, I mounted the DB to the HNSC web application, made sure the bindings and BackConnectionHostNames were good to go, and boom, success!!
Now all I have to do to get the kickass.contoso.com to be portal.contoso.com is run Set-SPsite https://kickass.contoso.com -URL https://portal.contoso.com, then double check bindings and back connection host names.