Here’s a common scenario. You’ve created a site in SharePoint and have business users going to it. You know they’ve bookmarked the site. Then, having learned some lessons and new tricks along the way, you create a new and improved site and want people to start going there instead. How to communicate? How can you catch all?
Enter the redirect. It tells the browser, no, don’t go here. You actually need to go there. How can we do this?
Well, it turns out to be incredibly simple (for this use case anyway – there are other scenarios where this solution isn’t a good fit). Go to the page that you want redirected and edit it. Put a script editor web part on the page (found in the content and media group). Click edit snippet. Put in the following:
window.location=”http://<address of the new and improved site>”
And that’s all there is to it. When I come to the old page, I will be redirected to the new and improved. How easy is that?!
What if I make a mistake and did a typo on the location? Well, that seems like it is a really sucky place to be. When you try going to the page to fix it, before you can stop it, you are redirected to the error message saying page does not exist (or whatever depending on the typo or mistake that you made). So how can I fix the page? This also turns out to be very simple. Type in the url to the page that the redirector is on but follow it with “?Contents=1” and that will take you to a page where you can delete the script editor. Then you can edit the page again, adding the script editor and this time getting the url right! 🙂
These are two valuable tricks that I am awfully glad to have in my toolbox. Special thanks to my friend Kimmo Forss for showing me both of these tricks!!!