Forum Discussion
Using iRules for Redirects with strings
I'm looking for a way to redirect as follows:
http://mytraining.site.com?_cid=xxxxx redirecting to http://www.site.com/training/index.htm?_cid=xxxxx
The xxxxx is a variety of numbers. Right now my rule cuts off the ?_cid=xxxxx
Any help is greatly appreciated.
3 Replies
- What_Lies_Bene1
Cirrostratus
HTTP::redirect "http://www.site.com/training[HTTP::path]?[[HTTP::query]"
- Kevin_Stewart
Employee
Something like this maybe:
when HTTP_REQUEST { set query "" if { [URI::query [HTTP::uri] _cid] ne "" } { set query "?_cid=[URI::query [HTTP::uri] _cid]" } HTTP::redirect "http://www.site.com/training/index.htm${query}" } - hoolio
Cirrostratus
Or maybe something like this example? This assumes that mytraining.site.com and www.site.com resolve to the same virtual server IP address.
when HTTP_REQUEST { if {[HTTP::uri] contains "_cid=" and not ([HTTP::path] starts_with "/training/index.htm"}{ HTTP::redirect "http://www.site.com/training/index.htm?_cid=[URI::query [HTTP::uri] _cid]" } }Aaron
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