HOWTO Change a SharePoint 2013 Host-Named Site Collection HNSC to a Path-Based Site Collection

I came up with this issue in our DEV SharePoint 2013 environment. I had created a host-named site collection using the powershell command:

New-SPSite -URL http://hostnamedsitecollection -WebApplication http://webappname

but I wanted to move it to it’s own host-header web application instead. Advice on the Internet is to backup-restore the content via Backup-SPWeb or other similar mechanisms such as import-export. However the site collection was pretty big and it would have taken a while.

STANDARD WARNING: The following steps involve direct editing of a SharePoint 2013 Content Database and is not supported by Microsoft etc etc end of the world etc etc

In SQL Server on the content database, the command:

SELECT Id, HostHeader
FROM dbo.AllSites

displays the host header url set against the site collection. Editing this value and setting it to NULL clears the host header setting. The process I used was as follows:

1. Remove the content database from the host-header Web Application #1
2. Change the HostHeader field to NULL in the content database
3. Re-attach the content database to the host-named Web Application #2

SharePoint should re-attach your content database, check the dbo.AllSites table, and add your site collection to the website using normal path-based site collection.

Yes, it’s a hack!

HTH

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: