Click here to Skip to main content
Click here to Skip to main content
Go to top

Change Site Collection URL in SharePoint 2010

, 30 Nov 2012
Rate this:
Please Sign up or sign in to vote.
How to change the name of a SharePoint site in URL

Introduction

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.

Background

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.

Using the Code

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
// 

History

  • 30th November, 2012 - Initial release

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

TexaWeb

Italy Italy
No Biography provided
Group type: Organisation (No members)



Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web01 | 2.8.140916.1 | Last Updated 30 Nov 2012
Article Copyright 2012 by TexaWeb
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid