SharePoint Online: Change Site Collection URL using PowerShell

Requirement: Change the Site Collection URL in SharePoint Online.

How to Change the Site URL in SharePoint Online?

Sometimes you may have to change the name of a site and URL after creating a site. Perhaps you’ve migrated to a new domain, changed the name of your department/project, or want to reorganize your site structure. Whatever the reason, we’ll walk you through the steps necessary to change your site URL in SharePoint Online.

In the past, We had to create a new site collection and run a migration tool to copy all contents from an old site to a new site to rename a site URL in SharePoint Online. Well, not anymore! Changing the SharePoint Online Site Collection URL is a relatively simple process that can be done in just a few minutes. If you have Global Administrator or SharePoint Online Administrator permissions, you can change the URL for the Microsoft 365 group-connected sites/non-group sites, Modern team sites, Communication sites, or Classic team sites. However, you can’t change the site address if the publishing feature is currently activated or was previously activated for the site, on sites with more than 15 million documents, Hub sites, and locked sites.

To change the URL of the existing SharePoint Online site, follow these steps:

  1. Login to the Modern SharePoint Admin Center >>  Click on “Active Sites” under the “Sites” section.
  2. Select the site collection you want to rename and open its properties pane.
    sharepoint online change site collection url powershell
  3. Click on the “Edit” link next to the site URL. Provide a new URL and hit the “Save” button. You’ll be prompted to enter the new name for the site. (The Site Name can be changed later by clicking Settings Gear Icon >> Site Information on the site.)
    Change site URL in SharePoint Online
  4. You’ll get a progress message next: “Updating site address”. Wait for it to turn to “Updated Site Address”. That’s all! Your site collection is renamed now!
    how to change sharepoint online site collection url

Changing site URLs can be done either through the SharePoint Admin Center or with PowerShell. Let’s see how to change the SharePoint Online site collection URL using PowerShell.

Important: “Start-SPOSiteRename” cmdlet is a new addition to the SharePoint Online PowerShell module. So, update your SharePoint Online PowerShell module first: “Update-Module”

SharePoint Online: Change Site Collection URL using PowerShell

Besides the SharePoint Online Admin center, We can also rename the site URL with PowerShell. Let’s rename a SharePoint Online site collection URL with the Start-SPOSiteRename cmdlet.

#Set Parameters
$SiteURL = ""
$NewSiteURL = ""
$NewSiteTitle = "Vendors" 

#Connect to SharePoint Online
Connect-SPOService -Url $AdminCenterURL -Credential (Get-Credential)

#Get all site collections
$Sites = Get-SPOSite -Limit All | Select -ExpandProperty URL

If($Sites -notcontains $NewSiteURL)
    #Rename SharePoint Online site URL using PowerShell
    Start-SPOSiteRename -Identity $SiteURL -NewSiteUrl $NewSiteURL -NewSiteTitle $NewSiteTitle -Confirm:$false
    Write-Host "New Site URL '$NewSiteURL' is not available!" -f Yellow

This script changes the URL of an existing site collection URL and Title from “Suppliers” to “Vendors”. When you change the URL of a site, SharePoint creates a copy of the site in the new URL and places a URL redirect on the old URL, so that anyone visiting the old URL will be redirected automatically to the site’s new URL (without having to update their bookmarks!)

rename site collection in sharepoint online

Please note that some side effects flow after the SharePoint site URL change.

  • The SharePoint data will remain intact when the site address changes.
  • OneDrive sync app continues to work after the site rename.
  • Sharing links will automatically redirect.
  • OneNote and iOS/Android mobile apps detect the change.
  • After the change, the new URL appears in the Recent Files section of the Office apps like Word, Excel, and PowerPoint web and desktop apps.

However, any custom solution’s URL dependencies may be affected. Any site customizations and embedded code that refer to URLs must be fixed after the site address change. Workflows to be republished, Power Apps- InfoPath forms have to be recreated. You’ll lose all files in the recycle bin if you rename a site collection. More on Microsoft article here

PnP PowerShell to Change the Site URL

Whether you need to change your site’s URL because you’ve changed the name of your team/project or reorganize your SharePoint sites, it’s easy to do in SharePoint Online. Just use the below PowerShell script, and you’ll have your site in a new URL up and running in no time! Please note, It is important to note that any links or bookmarks to the old URL will no longer work and will need to be updated.

$OldSiteURL = ""
$NewSiteUrl = ""

#Connect to SharePoint Online from PnP PowerShell
Connect-PnPOnline -Url $AdminSiteURL -Interactive

#Change sharepoint online site url powershell
Rename-PnPTenantSite -Identity $OldSiteURL -NewSiteUrl $NewSiteUrl

Overall, using PowerShell to change the URL of a SharePoint Online site collection is an efficient and straightforward way to update the URL of your site collection.

Is it possible to change the domain name of the SharePoint Online? You may need it in merger and acquisitions. Yes, You can! Reference: Change your SharePoint domain name

Changing the site URL doesn’t update the site name automatically! So, How do I rename a SharePoint site in PowerShell? Sure, To rename a site title in SharePoint Online, use: SharePoint Online: How to Rename a Site using PowerShell?


In conclusion, changing the URL of a SharePoint Online site collection can be accomplished using SharePoint Admin Center or PowerShell. By using the Connect-SPOService cmdlet to connect to SharePoint Online and the Start-SPOSiteRename cmdlet to change the URL of the site collection, you can easily update the URL of your SharePoint Online site collection.

It’s important to note that you should be cautious when changing the URL of a SharePoint Online site collection, because this process may break links and affect the functionality of the site. Before proceeding, you should make sure to test the process on a test environment, and also make sure that you have a backup of the site collection. Additionally, it’s important to update any hard-coded links or references to the site collection URL in any external systems and applications that rely on it. It is recommended to inform users of the change and update any necessary links or bookmarks.

How do you change the URL of a SharePoint Online list?

To change a list or document library URL in SharePoint Online, you can use these methods: Rename a list URL with File Explorer View, SharePoint Designer, or PowerShell!
More info: SharePoint Online Change List URL

How do I rename a file in SharePoint Online?

The quickest way to rename a document is, Right-click on your desired File and Choose the “Rename” option. Provide a new name to the file in the Rename pop-up and click Save. You can also rename files on SharePoint Online using PowerShell!
More info: How to Rename a document in SharePoint Online?

How do I change the Subsite URL in SharePoint?

To change the subsite address in SharePoint Online, follow these steps: Click on Settings >> “Site Information” and then “View All Site Settings”. Click on “Title, description, and logo” under the “Look and Feel” group, Enter the new URL for the subsite and click on “OK”. You can also use PowerShell to update the site address.
More info: SharePoint Online change subsite URL

Does renaming a SharePoint site change the URL?

No! Updating the site title from site settings or SharePoint Admin center (or PowerShell) doesn’t change the site URL.

Salaudeen Rajack

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

2 thoughts on “SharePoint Online: Change Site Collection URL using PowerShell

  • Hi,
    Editing the URL from the Admin center has worked fine for me previously, but for the past 2 months the option to edit any URL for any type of site is now greyed out. Do you know what might be causing this?
    Thank you

    • Yes! Here are the possible root causes:
      1. If a site is under retention policy – You can’t change the site URL!
      2. The Publishing feature is activated (or was previously active).
      3. A site with more than 15 million documents.
      4. Certain site templates like “Project Site” are not supported.


Leave a Reply

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