Forum Discussion
Jim_107778
Nimbostratus
Oct 30, 2008Redirect and a comparison in one....
Hi...I'm new to iRules and have received a request to do the following in the same iRule:
1 redirect from one domain to another
and look for a query string...and if found append with condition...if not..add the query..
For example:
https://original.domain.com/page.asmx?datatype=data
changes to
https://new.domain.om/page.asmx?datatype=data&cntgrp=Q
or
https://original.domain.com/page.asmx
changes to
https://new.domain.com/page.asmx?cntgrp=Q
Any suggestions on the structure of this iRule....and also any great places to work on irule examples for practice?
Thanks,
Jim
- hwidjaja_37598
Altostratus
Not sure whether it works. Give it a try:when HTTP_REQUEST { set newDomain "new.domain.com" set newUri [HTTP::uri] if { \ not ([HTTP::host] contains $newDomain) && \ $newUri contains "/page.asmx"} { if {$newUri contains "?"} { append newUri "&" } else { append newUri "?" } append newUri "cntgrp=Q" HTTP::redirect "https://$newDomain$newUri" } }
- Jim_107778
Nimbostratus
hwidjaja.....
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects