As you know, in a web application, a path-based site collection shares the same hostname; a host-named site collection is assigned to a unique hostname. This is the primary difference between path-based and host-named site collections. And according to TechNet’s comparison of host-named site collections and path-based site collections table, you realize the scalability of host-named site collections. You may even wonder how to convert an existing path-based site collection to a host-header site collection. In this post, I’ll show you how to do that in three steps using Windows PowerShell.
In this example, I created a path-based site collection using the following URL: http://chauo15sql:13608/sites/Test
Step 1: Backup of a site collection
Run the following command: Backup-SPSite http://server_name/sites/site_name -Path C:Backupsite_name.bak
In this example, I used the following command line Backup-SPSite http://chauo15sql:13608/sites/Test -Path C:BackupTest.bak then press Enter.
Step 2: Remove an existing site collection
Run the following command: Remove-SPSite –Identity “http://sitename” –GradualDelete –Confirm:$False
In this example, I used the following command line Remove-SPSite -Identity http://chauo15sql:13608/sites/Test -Confirm:$False then press Enter.
Step 3: Restore a site collection backup from the backup file to a host-named site collection
Run the following command: Restore-SPSite http://www.example.com -Path file_serversharesite_name.bak -HostHeaderWebApplication http://server_name
In this example, I used the following command line Restore-SPSite http://www.hnsc.com -Path C:BackupTest.bak -HostHeaderWebApplication http://chauo15sql:13608 then press Enter.
To finish, add the host to your SharePoint site and run the site.
Questions on how to migrate a bath-based site collection to a host-header site collection? Contact us or check out our online documentation!