cancel
Showing results for 
Search instead for 
Did you mean: 

URL Redirect format for {QUERY_STRING}

jhall1
Explorer
0 Kudos

Hello Everyone,

I currently have the following redirect rule in place which works as expected:

if %{HTTP_HOST} regimatch <host> [and]

if %{PATH} regimatch /SAP/BC/GUI/SAP/ITS/WEBGUI [and]

if %{QUERY_STRING} regimatch "~transaction=ZWFCA_LOGS"

RegIRedirectUrl ^/SAP/BC/GUI/SAP/ITS/WEBGUI(.*) https://<new Host>/SAP/BC/GUI/SAP/ITS/WEBGUI$1?%{QUERY_STRING}

I need to add another webgui transaction for the rule to hit on, so I updated above to:

if %{HTTP_HOST} regimatch <host> [and]

if %{PATH} regimatch /SAP/BC/GUI/SAP/ITS/WEBGUI [and]

if %{QUERY_STRING} regimatch "~transaction=ZWFCA_LOGS" [or]

if %{QUERY_STRING} regimatch "~transaction=CAT2"

RegIRedirectUrl ^/SAP/BC/GUI/SAP/ITS/WEBGUI(.*) https://<new Host>/SAP/BC/GUI/SAP/ITS/WEBGUI$1?%{QUERY_STRING}

This still works for the first query string but fails for the second. The match for HTTP_HOST and PATH are successful. The URL being parsed is:

http://<host>/sap/bc/gui/sap/its/webgui;~service=3200?%7etransaction=CAT2&%7enosplash=1&sap-client=0... Host>%3A7302%2Fsap%2Fpublic%2Fbc%2Fthemes%2F~client-010%2F~cache-VnncQw78IMPhPMkFLEe3MZNxPlI&sap-shell=FLP1.44.41

I have tried the following for the second query string as well:

if %{QUERY_STRING} regimatch "%7etransaction=CAT2"

and

if %{QUERY_STRING} regimatch "%7etransaction=CAT2(.*)"

Does anyone have any thoughts on how to properly form the second query string?

Thanks and regards,

Joe Hall

Accepted Solutions (0)

Answers (1)

Answers (1)

isaias_freitas
Advisor
Advisor
0 Kudos

Hello Joseph,

I think that the second AND (linking "if %{PATH} regimatch" to the first query string) is breaking the logic of the possible conditions.

This is based on the following sentence of this help.sap.com page: "Unlike programming languages the operators here have equal precedence. Operators are processed from left to right."

I believe that you have to create two separate set of rules:

#First tcode to test
if %{HTTP_HOST} regimatch <host> [and] 
if %{PATH} regimatch /SAP/BC/GUI/SAP/ITS/WEBGUI [and] 
if %{QUERY_STRING} regimatch "~transaction=ZWFCA_LOGS" 
RegIRedirectUrl ^/SAP/BC/GUI/SAP/ITS/WEBGUI(.*) https://<new Host>/SAP/BC/GUI/SAP/ITS/WEBGUI$1?%{QUERY_STRING

#Second tcode to test
if %{HTTP_HOST} regimatch <host> [and] 
if %{PATH} regimatch /SAP/BC/GUI/SAP/ITS/WEBGUI [and] 
if %{QUERY_STRING} regimatch "~transaction=CAT2" 
RegIRedirectUrl ^/SAP/BC/GUI/SAP/ITS/WEBGUI(.*) https://<new Host>/SAP/BC/GUI/SAP/ITS/WEBGUI$1?%{QUERY_STRING

Regards,

Isaías