0

I have would like to have the url as short as possible on a modern SharePoint environment. As such, I created the site "z". However, then the Home page would become

https://domain.com/sites/z/SitePages/Home.aspx

Now I also want to make this shorter. So I changed the Site Page library to "z", expecting the URL to become

https://domain.com/sites/z/z/Home.aspx

However, this does not seem the work when you change the name of the library it keeps being https://.com/sites/z/SitePages/Home.aspx

Can this be done differently?

1 Answer 1

0

You can modify the Site Pages URL via PowerShell.

Note: Once modified, you will not be able to access the url of the original site (https://domain.com/sites/z ), you can only access it through the new url (https://domain.com/sites/z/z/Home.aspx).

Please run the below PnP PowerShell as an admin:

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Set Parameters
$SiteURL = "https://domain.sharepoint.com/sites/sitename/"
$LibName = "SitePages"
$NewLibURL = "z"
  
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)
 
#Get the List
$Lib= Get-PnPList -Identity $LibName -Includes RootFolder
 
#sharepoint online powershell change list url
$Lib.Rootfolder.MoveTo($NewLibURL)

Invoke-PnPQuery

Here is my test:

enter image description here

enter image description here

enter image description here

enter image description here

1
  • For future reference, remark, the news on the site will also not work anymore.
    – WG-
    Commented Feb 24, 2022 at 11:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.