Forum Discussion

jjpagan_45121's avatar
Icon for Nimbostratus rankNimbostratus
Jul 14, 2011

301 redirect to new url with splash page and retain uri

I have a request to route all traffic destined for to using a 301 redirect. The twist is I must present a "you are being transferred to new site" message for 5 seconds before ultimately sending the request to



I have tried several different attempts at this with no luck. Any help is much appreciated.


4 Replies

  • You can use Javascript or a meta-refresh to display a message like that. The trick is figuring out what HTML to send back to the client. Once you figure that out, you can use HTTP::respond $status_code content "..." to do it.

    Here's one example from a random site:

    Note that if you want to include an iRule command or variable to set the host or URI dynamically, you'll need to wrap the HTML in double quotes and escape any quotes in the HTML with backslashes. Here's an untested example:

    HTTP::respond 200 content "
    Page has moved
    This page has moved. If your browser does not automatically redirect you in a few seconds, click  to go to the new page.

  • Thanks Aaron. I tried this yesterday w/o quotes.... I used curly braces for the content, but I could not get the uri variable to populate. I will try again with quotes in a few. Also, the respond 301 expects a location, so I could not get the content to be presented, unless I did a respond 200. I there anyway to return the 301 AND post the content to the user for 5s? Thanks again.





  • I just went through this exact exercise last month. The 301 was required by our marketing team because they wanted to transfer page rank (i.e. limit negative impact to search engine ranking). I don't think there's any way to send a 301 AND other content. That kinda goes against the intention of the 301 status code. Even the flexibility of iRules can't change that ;)



    Here are the options we came up with...



    1) Send a 301 to a landing page on that says "you've been redirected..." and after 5 seconds, redirect to the homepage of


    Problems: This doesn't meet the requirements. First, it will not get the user to the same URI on In addition, it will not transfer page rank to the correct URI...just to the new domain.



    2) Same as option 1, except you pass some identifier to the langing page that tells it where to redirect to after 5 seconds. (i.e.


    This method also does NOT transfer the page rank to the correct URI and there are some risks to passing things in the URI. These problems were enough for us to discredit this option.



    3) This was the best option for us. Send the 301 redirect from to Then on add a javascript to our global header that displayed a modal dialog explaining the redirect and then it disappeared after 5 seconds (revealing behind it). This transferred the page rank to the correct page AND showed the dialog explaining the redirect.


    One important note: we tried to use the referred to decide when to pop up the dialog, but it was not consistently sent with the redirect. Instead, we had to add a querystring to indicate that /uri was requested as the result of the 301 (i.e.


  • Yep, I just wanted to ask to make sure I covered all bases. We tried 1 & 2, but neither satisfied all of the requirements. Unfortunately, our Dev team is having trouble coding up a server-side solution. They are still trying.



    Thanks for your input, much appreciated.