Forum Discussion

Dixit_18200's avatar
Dixit_18200
Icon for Nimbostratus rankNimbostratus
Mar 07, 2017

Need help in redirection

Hi,

 

I need help as we have a requirement to redirect from one site to another site by keeping all content after / as same...example..if user tries to access abc.com/aa it should redirect to def.com/aa...similarly if he tries to access abc.com/bb it should get redirected to def.com/bb.

 

Any help is appreciated.

 

2 Replies

  • Dixit,

    Use the following iRule :

    when HTTP_REQUEST {
      HTTP::respond 301 Location http://nameofyournewsite.com[HTTP::uri]
    }
    

    Just replace 301 by 302 if it's temporary and replace [HTTP::uri] by [HTTP::path] if you wish to keep the path but not the query string. [HTTP::uri] will keep both path and query string.