Wednesday, May 8, 2013

Change Site Collection URL in SharePoint 2010

The Problem

If you want to change the site name (i.e. http://myserver/sites/SiteName/) in the site collection URL, you can't use Site Setting or Central Administration. Unfortunately, the only way is backup the site, delete it and restore in a new site with the right name.

In Sharepoint 2007, you can use the stsadm command to do this, but in SharePoint 2010 you can't do this. You have to use Windows PowerShell for SharePoint.




First of all, open SharePoint 2010 Management Shell, you can find it under Microsoft SharePoint 2010 Products in the Start menu.

The first step is backup the current site:
//
// Backup-SPSite http://myserver/sites/OldSiteName/ -Path C:\MySite.bak
// 
After that, delete the site using the following code:
//
// Remove-SPSite –Identity http://myserver/sites/OldsiteName/
// 
NOTE: This step is necessary only if you want to restore the buckup in the same server of the old site. You have to do this because after the restore, a lot of items (i.e. lists) use the same IDs of the original site.
Now you can restore the site in a collection with the right name:
//
// Restore-SPSite http://myserver/sites/NewSiteName/ -Path C:\MySite.bak
// 

No comments:

Post a Comment