SharePoint Online - How to configure redirect from Classic Subsite to Modern Site?

Amit Thakkar 1 Reputation point
2020-09-29T08:26:51.647+00:00

We are in the process to modernize all our Classic Sites to Modern Sites. We are re-creating all the sites and migrating the content from the older (classic) site to a newer (modern) site.

In this process, we are converting the Classic Subsites to Modern Sites.

Users have been provided the navigation links to the content from existing sites. So, we cannot change the URL of any site we are converting to modern. To manage this, we will be swapping the URL for root-level sites so not an issue there.

But, for subsite (e.g. Marketing Subsite inside Sales Site collection - /sites/Sales/Marketing), this is a problem. Because the example subsite here will become root level Modern Site with URL like /sites/SalesMarketing.

Now, anytime any user tries accessing any content with the Navigation URL provided for the Marketing subsite, we need them to auto-redirect to the new Modern subsite.

Please let me know what approach fits best here, any help would be appreciated.

Thanks!

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,685 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Trevor Seward 11,701 Reputation points
    2020-09-29T14:28:09.107+00:00

    You can add a script editor webpart to the home page and use a JS redirect. See https://www.w3schools.com/howto/howto_js_redirect_webpage.asp for examples.

    0 comments No comments

  2. Emily Du-MSFT 46,166 Reputation points Microsoft Vendor
    2020-09-30T08:39:25.66+00:00

    @Anonymous
    Agree with Trevor. Please remember to accept his answer if it helps you.

    Add to Trevor, here’re some references about how to add modern script editor web part in the SharePoint Online modern page.

    Add the script editor web part back to SharePoint modern experience
    Script editor web part for SharePoint modern pages


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  3. Evan Chatter 16 Reputation points
    2022-03-09T05:06:21.053+00:00

    It’s better than using window.location.href = ‘http://example.com’;

    Using replace() is better because it does not keep the originating page in the session history, meaning the user won’t get stuck in a never-ending back-button fiasco.

    If you want to simulate someone clicking on a link, use window.location.href

    If you want to simulate an HTTP redirect, use window.location.replace

    You can use assign() and replace methods also to javascript redirect to other pages like the following:

    location.assign("http://example.com");

    The difference between replace() method and assign() method(), is that replace() removes the URL of the current document from the document history, means it is not possible to use the “back” button to navigate back to the original document. So Use the assign() method if you want to Javascript load a new document, and want to give the option to navigate back to the original document.

    http://net-informations.com/js/iq/load.htm

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.