SharePoint Online: Change Site Collection URL using PowerShell

Requirement: Change Site Collection URL in SharePoint Online

How to Change the Site URL in SharePoint Online?

Previously, 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! To change the URL of the existing SharePoint Online site, follow these steps:

  • Login to Modern SharePoint Admin Center >>  Click on “Active Sites” under “Sites” section
  • Select the site
    collection you want to rename and open its properties pane.
    sharepoint online change site collection url powershell
  • 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.
    Change site URL in SharePoint Online
  • You’ll get a progress message next, saying: “Updating site address”. Wait for it to turn “Updated Site Address”. That’s all! Your site collection is renamed now!
    how to change sharepoint online site collection url

Changing site URL 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

Let’s rename a SharePoint Online site collection URL with 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 change the URL of an existing site collection URL and Title from “Suppliers to “vendors”.

rename site collection in sharepoint online

Please note, there are some side effects flows explained in Microsoft article here if you rename a site collection, like you’ll loose all files in recycle bin.

To rename a site title in SharePoint Online, refer: SharePoint Online: How to Rename a Site using PowerShell?

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

Leave a Reply