Forum Discussion
URL Redirect Question
I have to do a redirect and append the uri to the URL that I am redirecting to. Below is what I am looking to do.
Clients will come into this URL: a.bcde.com/10 Random Character Set
I will need to redirect to the following URL: f.ghij.com/site/now/10 Random Character Set (same from original Client incoming URL)
Any help on this is greatly appreciated!
Chris
3 Replies
- Michael_Jenkins
Cirrostratus
You could use an iRule like this to do the redirect. If it's just basic, then this should do (if you always want to redirect, you could even take out the
statement). Do you need to do anychecking on the 10 digit URI string?ifwhen HTTP_REQUEST { if { [string tolower [HTTP::host]] equals "a.bcde.com" } { HTTP::redirect "http://f.ghij.com/site/now[HTTP::uri]" } } - Chris_123510
Nimbostratus
Michael,
Thank you for the assistance on this! We just had the chance to test it and it worked just like we wanted it to. I did make a slight change, I took the / out from behind "now" in the redirect, as the [HTTP::uri] will bring the trailing / from the original URL.
Chris
- Michael_Jenkins
Cirrostratus
Oh yea. Forgot that the HTTP::uri always has the initial "/" on it. I've updated my original answer to reflect that. Good catch! If you don't mind, please mark the answer as the solution so others can see that it's been solved. Thanks!
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com