How to rename a SharePoint Online site and re-use the URL

In this post we will explore how to rename SharePoint Online sites and re-use the original URL.

  1. Intro
  2. How to use an old site URL
  3. More information

Intro

Have you ever changed the name of a SharePoint Online site and tried to re-use the old URL for a new site? If you have you have probably encountered an issue where SharePoint admin center will tell you that URL is still in use. Well this is because the URL is, in fact still in use in the form of a redirect.

Old site URL is unavailable after renaming a SharePoint site.

In 2019, Microsoft introduced the site rename feature within the SharePoint admin center, which also updated site URLs too. Once a URL is updated for a given site, or moved to a different geo location, or as part of a site swap – a redirect is automatically created to ensure any links that were pointing to the prior URL continue to work.

How to use an old site URL

To use on old site URL you need to run the following PowerShell command. Note: You will need the SharePoint administrator role to run this command:

  • Open the SharePoint Online Management Shell and run the following command:
Connect-SPOService -Url https://[TENANT]-admin.sharepoint.com

Remove-SPOSite -Identity https://contoso.sharepoint.com/sites/OldSiteName
  • Confirm you want to delete the redirect

Check your URL has been deleted by trying to browse the URL, if you get a 404 error it has been successful.

More information

The Remove-SPO site command is actually defined as “Sends a SharePoint Online site collection to the SharePoint Online Recycle Bin” in the Microsoft documentation reference guide.

Microsoft documentation says that a redirect template (Template type: REDIRECTSITE#0) is applied when the site URL is updated, which contains special headers and logic to redirect your browser requests to the new site.


Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s