How to redirect SharePoint Site Collection to different URL


Scenario and Requirement

Consider a scenario where you share a particular SharePoint link with your colleagues and other co-workers. Users have a tendency to bookmark frequently accessed URLs.

For some reason, this content on this page is moved and there is a new site/page which hosts the content now. If users access this page, they will get undesired results.

It will be a good idea to redirect the users to the new page (site collection, subsite, page) when the current bookmarked URL is accessed.

Simple HTML Solution

The simplest way to achieve this by using a standard HTML + JavaScript approach and adding a script for redirection.

Follow these steps -
  1. Edit the SharePoint page.
  2. Add a Content Editor web part.
  3. Add below code in the content editor web part. Optionally you can also display a message if needed.
  4. This page has shifted, you are being redirect to http://code2care.org
  5. <script>
    window.location.href = "http://code2care.org";
    </script>
  6. Save web part changes.
  7. Save and publish the page.
  8. Test the page for redirection.

By doing so, the page will instantly navigate and redirect the user to the specified URL.






Recent Posts:
Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and Software Developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include Learnings, Video Tutorials, Code Snippets, How Tos, Blogs, Articles, etc.