Change site collection URL in SharePoint 2013

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!

The solution
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

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!

18 thoughts on “Change site collection URL in SharePoint 2013

  • It tells me to empty Recycle Bin first.
    Exception calling “Rename” with “1” argument(s): “Cannot rename a site collection with recycled items. Empty the site recycle bin of site collection https://share.test/office/test and retry.”
    At line:1 char:1
    + $site.Rename(“https://share.test/office/one”)
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentException

  • Nico – So, is there no way to change “http://sharepoint/sites/marketing to http://sharepoint/marketing (Even if the Explicit inclusion managed path exists)?” I just spun up a site with /sites/ and wildcard inclusion managed paths then realized that I wanted to ensure Global Navigation would work. The best way to do this seems to be reusing terms in site collection navigation which requires… Explicit Inclusion managed paths.

    Hoping not to have to blow away all my work.

    • Hi Michael,

      I don’t think that scenario is supported by the rename function. However, you can still create a backup of the site collection and restore it to the location of your choice. Or you could use the Copy-SPSite cmdlet.

      I hope this helps.



  • Warning! I tried this with a special character in the URL “ü” and this made my site unreachable. Even worse I can’t find the site with powershell as well! In the Admin Control Center I see the site collection but it looks messed up no information is displayed. I know the site is still on the database since the Sitecount on the DB is higher than the amounts of sites I get with the command get-spsite. Any advice how I can change the URL back?

    • Hi,

      You can do that by changing the URL of the Web Application. This can be done by changing the Alternate Access Mappings. Make sure you update your DNS as well.

      • Hi nice post,
        and my question after I change via AAM default zone should I delete the DNS name previous URL?

        • After you have changed the required, you could remove the old DNS name.
          Make sure you changed the AAM default URL and IIS bindings and added the new URL to DNS.

          • OK well thanks a lot I understand and on IIS binding I must add new bind on old site name or just rename that old bind. ?

  • Hi , Is this command doesn’t rename root site collection to different, Is this possible anyhow?

    I tried to eecute below command but it throw an error

    $site=Get-SPSite http://sharepoint/


    Exception calling “Rename” with “1” argument(s): “Only host part for a host
    header site collection or the last segment after a wildcard managed path of a
    site collection Url can be renamed. http://WebApp_URL/sites/sales is
    an invalid new Url for the site collection at http://WebApp_URL.”
    At line:1 char:1
    + $site.Rename(“http://WebApp_URL/sites/sales”)
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentException

    • Hi Vishal,

      Renaming the root is indeed not supported. You could do a backup-spsite and restore-spsite to restore it to another site collection URL.

  • Using your example, I shoudl be able to do this in one pass, correct?

    $site = Get-SPSite http://sharepoint/sites/cfsocc-a

    I am using Host named Site Collections with the Wildcard Managed Path of “Sites”. Do this also change the path for the existing subsites as well? In addition, would this chnage the path on the Term Store being used for Managed Navigation or just create a new one? Many thanks in advance/

  • Hi John,

    Yes you should be able to run it. Make sure to do an IISRESET afterwards.
    – Subsite URL’s will be changed as well (they are all saved in the database as relative paths)
    – For the term store question, I am pretty sure this will keep working. I haven’t tested this though.


  • I have done this .after iisreset , the site is working fine ,but the search content Web part on the page is no longer working.please help

Leave a Reply to Aravinda Rao Cancel reply

Your email address will not be published. Required fields are marked *