Could not rename this site collection. The URL specified is already in use
-
07-01-2021 - |
Domanda
I am trying to rename a site collection, using scripts something like this:
$site = Get-SPSite http://portal.contoso.com/sites/foo
$uri = New-Object System.Uri("https://foo.contoso.com")
$site.Rename($uri)
I used stsadm:
stsadm -o renamesite -oldurl http://test.matt.com -newurl https://test.matt.com
But does not work and I keep getting this error.
Exception calling "Rename" with "1" argument(s): "Could not rename this site collection. The URL specified is already in use."
I did a test on another web application using the scripts above, and that worked just fine. Not in this one though.
This one has three zone:
- Default
- Extranet
- Internet
I got the scripts from these urls:
- change-host-named-site-collection-url
- getting-error-exception-calling-rename-with-1-arguments-could-not-rename
What could be the problem?
Update: I am updating a site collection host header to a site collection host header.
Update 2 SSL is enabled at Web Application level. There are 500+ site collections
Soluzione
Try to do an backup-spsite
and then remove the site, and finally restore it back.
Use this code. It has worked for me. Modify the url parameters as needed and the path of the file.
Backup-SPSite https://currentsite -Path D:\backupsite.bak
Remove-SPSite –Identity https://currentsite –Confirm:$False
Restore-SPSite https://newsitesiteurl -Path D:\backupsite.bak -HostHeaderWebApplication https://webapphostnameurl.com
Altri suggerimenti
Can you check whether any site with same name is listed in SPDeletedSite? Use PowerShell script to see the list of deleted site
==>Get-SPDeletedSite
If you can see the site with the same name,copy the identity of site and remove it using below powershell command
Remove-SPDeletedSite –Identity 9d0ed313-0353-4cec-817a-a491a8c5fc26