Summary: This post describes the different ways to change the site collection URL in SharePoint 2013.
So, your manager/the business asks you to create a few site collections for some departments in your organization. You quickly spin up some site collections for them to use. After a few weeks, the business decides (of course) SharePoint is great, but the URL’s we chose weren’t all that great. Can you please change them?
There are alot of blog posts out there that describe the different possibilities in this scenario:
– Using backup and restore.
– A great article by Todd Klindt that tells you how to use the Copy-SPSite cmdlet to achieve the same goal but easier!
There is another (easier) way in some scenario’s in which you can change the site collection URL by just using 2 lines of PowerShell with only a second of waiting time!
Let’s get down to it.. I created this very nice Marketing site collection, using the url: http://sharepoint/sites/marketing. Now I would like to change this to http://sharepoint/sites/sales. Just use the following 2 lines of PowerShell code and you are done!
$site = Get-SPSite http://sharepoint/sites/marketing $site.Rename("http://sharepoint/sites/sales")
That is all.. try it out and see that your new URL is working, and the old URL is not working anymore!
*NOTE* Thanks to Jaymeson in the comments for pointing out an IISRESET is needed as well!
A little catch
There is a little catch to this. You can only use this to rename site collection URL’s that
– Use “Wildcard inclusion” Managed Paths.
– Are Host named site collections (In which case you could also use Set-SPSiteURL)
You can’t use it to change http://sharepoint/sites/marketing to http://sharepoint/marketing (Even if the Explicit inclusion managed path exists).
Hope this helps anyone out there!