SharePoint timeoutWorking with a client recently, we had a need to solve a URL redirection issue. In discussions we tossed around using SharePoint AAMs, IIS URL Rewrite and other possibilities. It’s great when the best solution turns out to be the easiest! The best solution ended up was to use a SharePoint Redirect page. It’s not something that is used very often, but it certainly fit the bill for our issue. 

My focus in this quick tip is not to explain why I used a redirect page, that part should be obvious. All it does is automatically redirects someone to a URL you choose after a 5-second time delay when they hit the redirect page. Instead, my focus is to show you how to change the timeout value as I couldn’t find that documented anywhere else.

By default when you create a redirect page, you just edit the web part and type in the URL that you want the page to redirect to, then save/publish. Users see the page, sit the obligatory 5 seconds, then go to the final location. This was a complete temporary solution that will be removed after about a month, so we just wanted it to go as fast as possible. You could have used JavaScript in a content editor web part in a page to do the same thing, as this post suggests on Anyway, let’s get to it. 

To do this, the redirect page is a publishing page layout. So to change the timeout, we need to edit the page layout. 

  1. Open the root web in the site collection in SharePoint Designer, and click Page Layouts from the left side navigation.
  2. Since you NEVER modify default page layouts (or master pages for that matter), right click on RedirectPageLayout.aspx and choose Copy, then right click and choose Paste. Rename the file to whatever you like. Right click on and choose Properties if you want to update the Title name.
  3. Now to make our change. Right click on the file and choose Edit File in Advanced Mode. Say yes to check out the file.
  4. Search for this text – SecondsBeforeRedirect. This is the line we’re interested in:

    SharePoint redirect page SecondsBeforeRedirect
  5. By default, this will read:
    1. SecondsBeforeRedirect="5"
    2. Change the 5 to whatever value you like. In our case, we want as instant as possible, so change to 0. 
  6. Save, and check in the page. Publish the page, then approve.
  7. Now that the page is published, we can create our page from the layout. Go to whatever site you want your page, and go to the Pages library. Click New, and click Redirect Page, then choose your new layout (it says 1 sec but I just never changed the name to 0).
  8. Now just edit your page, give it the URL, save and publish, then watch the magic happen!

Again, the same thing can be done even easier than this using the method from using JavaScript and CEWPs. But, I wanted to show how you would change the timeout values in the default SharePoint page layout for a redirect page.

Todd Klindt goes into detail about doing redirects with SharePoint in this blog article. If you'd like more information on C5 Insight's services or solutions, please contact us.