40,098 total views, 1 views today
Want to change site URL in SharePoint online? Previously, when we worked in SharePoint on-premise, it was nearly impossible to consider changing the site URL after it was created; we used to say we could rename the site title but not the site URL. These days, SharePoint has gone through lots of revolutionary changes, and Microsoft has made SharePoint professionals’ lives much easier. Changing or renaming the site URL is one of them. Now, we should not be worried about the site URL. If your site URL does not fit your requirements, you have the flexibility to rename or change the site URL.
Here, in this article, we will learn how to change or rename the SharePoint site URL using the PowerShell script and modern SharePoint admin center UI.
Key-Highlights: change site URL in SharePoint online
- Change a site address in the new SharePoint admin center
- Change SharePoint Online site address using PowerShell
- What are the effects of changing a site address in SharePoint Online?
Change a site address in the new SharePoint admin center (change site URL in SharePoint online)
Login to the SharePoint admin center site using the below format URL:
https//yourtenant-admin.sharepoint.com Example: https://globalsharepoint2020-admin.sharepoint.com
Click on the “Active sites” link from the left side panel.
Select the site for which you want to edit the URL.
Double click on the site title link as shown in step 2.

Then a site configuration modal page will be opened on the right-hand side, from there click on the “Edit” link under the URL tab (shown in step 3).
Then the “Edit URL” page will be opened.

Type the new URL name in the site address box.
Then it will validate the new site address whether the site address is available or not.

Once we see the “The site address is available.” green message, click on the “Save” button.

Then, we will see the “Change site name? – Do you also want to enter a new site name?” confirmation message.

Click on the “Yes” button
Then click on the “Cancel” or cross button as shown below:

Now we could see that the site URL has been updated as highlighted below.

That’s it, done 🙂
Change site URL using PowerShell in SharePoint Online (change site URL in SharePoint online)
Now we will learn how we can change the SharePoint Online site URL using PowerShell, the above steps are what we have done in order to change the site address in SharePoint Online using the SharePoint admin center, we can do the same here using the PowerShell script.
####The below script will change the existing site URL to a new URL. cls $PSshell = Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorVariable err -ErrorAction SilentlyContinue if($PSshell -eq $null) { Add-PSSnapin "Microsoft.SharePoint.PowerShell" } $fileName = "Change_SPO_Site_URL" #'yyyyMMddhhmm yyyyMMdd $enddate = (Get-Date).tostring("yyyyMMddhhmmss") #$filename = $enddate + '_VMReport.doc' $logFileName = $fileName +"_"+ $enddate+"_Log.txt" $invocation = (Get-Variable MyInvocation).Value $directoryPath = Split-Path $invocation.MyCommand.Path $directoryPathForLog=$directoryPath+"\"+"LogFiles" if(!(Test-Path -path $directoryPathForLog)) { New-Item -ItemType directory -Path $directoryPathForLog #Write-Host "Please Provide Proper Log Path" -ForegroundColor Red } #$logPath = $directoryPath + "\" + $logFileName $logPath = $directoryPathForLog + "\" + $logFileName $isLogFileCreated = $False function Write-Log([string]$logMsg) { if(!$isLogFileCreated){ Write-Host "Creating Log File..." if(!(Test-Path -path $directoryPath)) { Write-Host "Please Provide Proper Log Path" -ForegroundColor Red } else { $script:isLogFileCreated = $True Write-Host "Log File ($logFileName) Created..." [string]$logMessage = [System.String]::Format("[$(Get-Date)] - {0}", $logMsg) Add-Content -Path $logPath -Value $logMessage } } else { [string]$logMessage = [System.String]::Format("[$(Get-Date)] - {0}", $logMsg) Add-Content -Path $logPath -Value $logMessage } } ########################Rename SharePoint Online site URL using the PowerShell script############################## #Paramaters area $adminSiteURL="https://globalsharepoint2020-admin.sharepoint.com" #Your SPO Admin center URL $OldSiteURL="https://globalsharepoint2020.sharepoint.com/sites/TestCommSite2Modified" #Old Site URL $NewSiteURL="https://globalsharepoint2020.sharepoint.com/sites/TestModifiedURLUsingPS" #New Site URL $userName = "YourSPOUser@globalsharepoint2020.onmicrosoft.com" #Your SPO username $passWord = "YourSPOPassword" $encPassWord = convertto-securestring -String $passWord -AsPlainText -Force $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $userName, $encPassWord #Paramaters area - Ends Try { Connect-SPOService -Url $adminSiteURL -Credential $cred ################Validating site URL renaming using the PowerShell command ############## Write-host -f Yellow "Validating site URL renaming: "$NewSiteURL $validationStatus=Start-SPOSiteRename -Identity $OldSiteURL -NewSiteUrl $NewSiteURL -ValidationOnly Write-host -f Green "Validated site URL renaming: "$NewSiteURL ################Validating site URL renaming using the PowerShell command - ends here #### ############Changing site URL using the PowerShell command####################### if ($validationStatus.ValidationState -eq "Success") { Write-host -f Yellow "Site URL renaming started in: "$OldSiteURL Start-SPOSiteRename -Identity $OldSiteURL -NewSiteUrl $NewSiteURL Write-host -f Green "Successfully site URL has been renamed, the new URL is: "$NewSiteURL } ############Changing site URL using the PowerShell command - ends here############# } Catch { $ErrorMessage = $_.Exception.Message +"in renaming the Sharepoint Online site URL!:" Write-Host $ErrorMessage -BackgroundColor Red Write-Log $ErrorMessage } ########################Rename SharePoint Online site URL using the PowerShell script - Ends here ##############################
Prerequisites to execute the above script: change site URL in SharePoint online
- The user account that is executing the script should be either global admin or SharePoint admin.
What are the effects of changing a site address in SharePoint Online (change site URL in SharePoint online)?
Well, till now we have learned how to edit or rename site URL both using the SharePoint admin center and PowerShell script, however, there are some adverse impacts on this process, and we need to take care of those. Below we will discuss the effects of changing a site address.
Apps
If apps in your organization refer to the site’s URL, you might need to republish the apps when you change the site’s address.
Custom Forms Created in PowerApps
We need to recreate the custom form in PowerApps after the site address change.
Hub sites
If the site is associated with a hub, it will need to be reassociated after the site address is changed.
InfoPath forms
InfoPath forms that refer to URLs might not work after the site address is changed, we need to update the Infopath form or data connection URL as well.
List View web part
If a List View web part is added to a page and scoped to a specific folder in that list, the web part might display an error after the site URL is changed. To fix this issue, either edit the web part and reset the folder path or remove the web part from the page and then add it again.
Microsoft Forms
If the site is a Microsoft 365 group-connected site that has forms in Microsoft Forms, any File Upload questions in forms will break. To fix this issue, recreate the file upload questions to allow responders to upload files again.
OneNote
If users have a notebook open during the site address change, they’ll see a notebook sync error.
Permissions
People who have permission to access the site can access the site during and after the site address change.
Power Apps
We need to reconnect the app or apps to your data source in PowerApps.
Power Automate
Power Automate (Microsoft Flows) will need to be recreated after the site address change – if that site was referred to in the flow connection.
Recent lists inside Office apps
The Word, Excel, and PowerPoint desktop apps and apps for the web will show the new URL after the change.
SharePoint mobile apps for Android and iOS
The SharePoint mobile apps will detect the site’s new URL. Make sure that users have updated their apps to the latest version.
SharePoint workflow 2013
SharePoint workflow 2013 will need to be republished after the site address is changed, in case the site had SharePoint 2013 workflow.
Sharing links
After the site address is changed, sharing links will automatically redirect to the new URL.
Teams (for Microsoft 365 group-connected sites)
When the site address change is complete, users will be able to access their SharePoint files in the Teams app.
Synced locations
The OneDrive sync app will automatically detect and seamlessly transfer syncing to the new site URL after the site address has been changed.
Summary: Change site URL in SharePoint online?
Thus, in this article, we have learned the below with respect to changing the site URL in SharePoint Online:
- How to change or edit the site URL in SharePoint Online using a modern admin center.
- How to change or edit the site URL in SharePoint Online using PowerShell script.
- What are the effects of changing a site address in SharePoint Online?
See Also: Change site URL in SharePoint online
You may also like the following SharePoint PowerShell tutorials:
- Deploy SPFx solution in SharePoint online site collection scope only
- SharePoint Online: Remove custom app using PnP PowerShell
- Office 365: How to create content type in SharePoint Online using PowerShell?
- Office 365: How to create document library in SharePoint Online using PowerShell?
- Export SharePoint user information list to CSV(Excel) file using PowerShell
- How to fix “The term ‘Get-MsolUser’ is not recognized as the name of a cmdlet”
- How to fix the “The term ‘Get-SPWeb’ is not recognized as the name of a cmdlet, function” PowerShell error
- How to hide quick launch menu in SharePoint online using PnP PowerShell
- Edit user Permission is greyed Out SharePoint Online
- Get workflow inventory from SharePoint online using PowerShell CSOM
- Create a modern team site using PnP PowerShell in SharePoint
- In 2 steps convert a classic SharePoint page to modern using PnP
- SharePoint Online: Delete All Files from document library for the given date – PowerShell CSOM
- Create SharePoint online list using PnP provisioning template
- SharePoint Automation: PowerShell script to get remote server information
- Office 365: Retrieve hub sites and associated sites using PnP Powershell
- SharePoint Online Automation – O365 – Upload files to document library using PowerShell CSOM
- SharePoint Online Automation – O365 – Create multiple items in a list using PowerShell CSOM
- SharePoint Online Automation – O365 – Update document library metadata using PowerShell CSOM
- Introduction to SharePoint information architecture
Hope you have enjoyed reading this article and helped you. If you would like to appreciate our efforts, please write to the below comment section and do share this with your friends and colleagues. 🙂