irule to change url with preserving query parameters and include extra names in the final url
Hello,
I am new to irule. Below are the details of my requirement :
I have this url : http://xyz.com/test_check.do?test_id=XXX
I want to write an irule so that it will redirect/respond this to below and it will preserve all dynamic variables(XXX) during redirect or respong. http://xyz.com/testing/test_check.do?test_id=XXX
I have tried to write irule, but its not working :
when HTTP_REQUEST { if {[string tolower [HTTP::uri]] starts_with "/test_check"} { HTTP::respond 302 Location "https://xyz.com/testing/[URI::query [HTTP::uri]]" } }
Please provide suggestions/help me to resolve this.
Thanks in Advance !!!
I have tried below irule, added in the irule list and it worked correctly :
when HTTP_REQUEST { if {[string tolower [HTTP::uri]] starts_with "/test_check.do?test_id="} { HTTP::redirect "https://xyz.com/testing[HTTP::uri]" } }
Thanks you all for your responses.