vendredi 28 août 2020

Apache directive to not to redirect REQUEST_URI with IF condition

The Apache directive is working successfully to redirect the web application URL if it contains "/login" string in REQUEST_URI to the help page. This works with a single directive as below.

RedirectMatch 301 "^(.*)" "https://ift.tt/3luZyZJ"

However, I wanted to not to redirect to help page if "REQUEST_URI" contains string "login?next=/scm"

I modified/added directive as below however it's not working as expected, any suggestions are welcome.

    <LocationMatch "^/login">
<If "%{REQUEST_URI} =~ m#/scm#">
#Do nothing
</If>
<Else>
       RedirectMatch 301 "^(.*)" "https://x.y.com/help-url/"
</Else>
</LocationMatch>

Aucun commentaire:

Enregistrer un commentaire