1

We use Apache HTTPD server version 2.2. I try to use RedirectMatch of Apache 2.2 mod_alias without success ( http://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirectmatch)

I need to create rule that will redirect only URLs whit parameters change_url=1 for example

https://<IP>/servlet1?id=1&type=2&change_url=1 

I have tried to use the following rule:

RedirectMatch (.*)change_url=1(.*) /keepurlprocess/$1

Unfortunately it does not work with required URL only when the change_url in the URL:

https://<IP>/change_url=1 

What wrong in my regular expression? How can apply it to query parameters? In addition, I have some specific parameter type. For some types I do not need to perform redirect:

https://<IP>/servlet1?id=1&type=do_not_redirect&change_url=1 

Is it possible to create rule like below?

RedirectMatch (.*)(change_url=1 AND NOT type=do_not_redirect)(.*)  /keepurlprocess/$1
Michael
  • 597
  • 3
  • 9
  • 23

1 Answers1

0

Take a look here. You should be able to drop a redirect in an IF statement

https://httpd.apache.org/docs/2.4/mod/core.html#if