I have an external website which needs to show URL in lowercase only. I don’t want to use URL Rewrite or any third party tool. Instead we decided to change the actual URL’s of the Pages Library. I’ve done that by using the following script.

if ($list.RootFolder.Url.Equals("Pages"))
    $ListURL = $SPWeb.url + "/" + $list.RootFolder.Url
    Write-Host $ListURL
    Write-Host "Title: " $list.Title ", Url: " $list.RootFolder.Url -foregroundcolor magenta

        $list.Title = $list.Title.ToLower()
    #catch [System.Management.Automation.RuntimeException] 
    #    write-host 'RuntimeException'


    Write-Host "Title: " $list.Title ", Url: " $list.RootFolder.Url -foregroundcolor darkgreen

if ($SPWeb -ne $null)

... which outputs ...

http://dev. ... /contact/Pages
Title:  Pages , Url:  Pages
Title:  pages , Url:  pages

Yes, I get a Runtime Error, but the URL and list name actually changes (se image).

enter image description here

If I go to a page in the pages library directly, I get the new URL, but if I write the short hand URL (without /pages/default.aspx) I get the previous initial uppercase letter /Pages URL. My question is why, and how do I resolve this?

  • First of all, the MoveTo method doesn't return anything, so you can't use it to assign a new value to the $list.RootFolder.Url property. Let's see if it works better if you leave that part out and just simply: $list.RootFolder.MoveTo($list.RootFolder.Url.ToLower())
    – Norbert
    Jun 26, 2013 at 12:51
  • @Norbert That's why there was a RuntimeException which was solved by your method. Thanks! But browsing to the web without the 'pages' specified redirects to 'Pages' with a capital P which I wanted to avoid. Can't imagine why that happens.
    – Benny Skogberg
    Jun 26, 2013 at 13:11

1 Answer 1


You are redirected to the Pages library instead of pages because there is a property on the web level, which holds the old URL of the default page. In order to fix this, you will need to insert the following snippet into your script:

$folder = $SPWeb.RootFolder;
$folder.WelcomePage = $folder.WelcomePage.Replace("Pages","pages");

I hope this helped. If not, please feel free to ask me for details.

  • 1
    +1 Super! It worked as expected! I've taken the liberty to generalize your code on row 2 to $folder.WelcomePage = $folder.WelcomePage.ToLower() Thanks for your input!
    – Benny Skogberg
    Jun 26, 2013 at 18:15

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.