Can you create a SharePoint redirect site using the REDIRECTSITE#0 template?

Copper Contributor

If you accidentally deleted a redirect site that led from sharepoint.com/sites/old-url to sharepoint.com/site/new-url (that had the REDIRECT#0 template), is there any way to recreate the redirect site to put it back? 

 

It seems that the redirect sites do not show up in the SharePoint admin centre under "deleted sites". They also do not appear using PowerShell's Get-SPODeletedSite cmdlet.

 

Does anyone know if there is any way to recover or recreate the redirect site at all?

5 Replies

@Alex-S-NZ 

 

Redirect site gets created as part of changing a SharePoint site address, moving a site to a different geo location, or swapping a site.

If you perform any of above operation again, you should have it working back.

This could be a solution - thanks for posting it! I'll let you know how I get on. Just out of curiosity will it redirect everything - or just links to the main page?

 

For example - if a webpage was linking to sharepoint.com/site/oldsite/files/file1.jpg would this method forward the request to sharepoint.com/site/newsite/files/file1.jpg ? I guess I'm looking for the equivalent of a .htaccess rewrite rule or something which has the same features as the REDIRECT#0 template implementation.

@Alex-S-NZ 

Did you try swapping the site one more time?

No, because there are a large number of site redirects that were deleted. And it would also involve swapping the sites twice for each one and disabling the site deletion policy to ensure all links in the organisation continue to work - this would mean:

- Renaming the new site URL to the old site URL (that is, to the URL of the redirect site that was deleted)
- Disabling the site deletion policy
- Deleting the new site URL after disabling the site deletion policy
- Rename the old site URL back to the new site URL in order to re-establish the redirect site.

Although it is an interesting solution I wouldn't try it unless there was no other option.

In the meantime I have engaged Microsoft to recover the redirect sites.

It seems very odd to me that Microsoft documentation doesn't warn people when running Power Shell Commands that some of the sites are redirect sites that are created and managed by Microsoft - but still allow them to be deleted without identifying them as redirect sites. And then unlike regular sites which are deleted the redirect sites don't go into the recycle bin in case you need to recover them.

As far as I'm concerned it is completely normal in large organisations to have business units change their name on numerous occasions over the time. This often necessitates the changing of the site URL - which is why these redirect sites exist to begin with. So old links continue to work.

The fact that Microsoft makes no mention of the importance of not deleting these links (unless they are orphaned redirect sites - that is, the site they link is also not required) is a pretty big oversight as far as I'm concerned.