Monday 7 July 2014

Changing SharePoint Host Named Site Collection Default URL

After changing a site from http to https I was unable to change the default zone URL for the SharePoint site which was hosting host named site collections.

Having the default zone as http was causing multiple issues (Workflows, OWA, Search) as lots of requests were still using http and our load balancer was forcing all traffic to https.

You have some PowerShell available to aid the administration of URLs for host named site collections.

Get-SPSiteURL
Set-SPSiteURL

Firstly I edited by default AAM in Central admin to be https://test.matt.com.

Now using PowerShell I'll show how my site looks currently.

Get-SPSiteURL -Identity http://test.matt.com




Using Set-SPSiteURL you can add new URLs to host named site collection for different zones.

Set-SPSiteUrl (Get-SPSite 'http://test.matt.com') -Url 'https://test.matt.com' -Zone Intranet





Get-SPSiteURL -Identity http://test.matt.com

You will see your additional URL in separate zone.



You can see I have set multiple zone URLs for the host named site collection.

You will not however be able to change the default zone URL with PowerShell SPSite command.

Set-SPSiteUrl (Get-SPSite 'http://test.matt.com') -Url 'https://test.matt.com' -Zone Default



I needed the default zone for the root site to change so that all my host named site collections within the web application would also inherit https by default.

So I removed the Intranet zone URL I added as I do not need this I need to change the default zone URL.

Remove-SPSiteURL -URL http://test.matt.com



Get-SPSiteUrl -Identity http://test.matt.com

Back to just a single URL.



So we have to go back in time and break out stsadm.exe

Open command prompt and run CD C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\BIN


Then run the following command:

stsadm -o renamesite -oldurl http://test.matt.com -newurl https://test.matt.com



And finally lets now check our default URL

Get-SPSiteUrl -Identity https://test.matt.com (Use your new URL here)

Its now changed the default URL!






Something to bare in mind is that this has changed the default URL for the host named site collection. The web application will still have the original default URL in the configuration database and you cannot change this without recreating the web application.

This was a pain for me so hope it can be of help!


2 comments:

  1. Thanks for sharing information on SharePoint Host Named Site Collection in this article, I founded the Hosted name site collection on https://www.cloudappsportal.com/

    ReplyDelete