Skip to Content

URL Redirect format for {QUERY_STRING}

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=010&sap-language=EN&sap-ui-tech-hint=GUI&sap-ie=edge&sap-theme=LYB_belize%40https%3A%2F%2F<new 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

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Feb 21, 2019 at 06:13 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.