Modify the Subsite (Web) URL

Scenario/Problem: You want to rename the relative URL name for a subsite.

Solution: Use the Set-SPWeb cmdlet with the RelativeURL parameter.

You can easily change the name of the relative URL in which a subsite is accessed by using the Set-SPWeb cmdlet. Provide the URL of the site as the Identity parameter, and use the RelativeURL parameter to provide the new URL, as shown in Listing 8.16.

Listing 8.16. Renaming a Subsite

Set-SPWeb -Identity "http://sp2013/sites/sitecol/newsubsite"-RelativeURL teamsites

Notice that the RelativeURL value is not a full URL. The example essentially renames the subsite URL from newsubsite to teamsites. Therefore, after execution, the subsite is accessed by http://sp2013/sites/sitecol/teamsites/. ...

Get PowerShell™ for SharePoint® 2013 How-To now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.