What wrong with RedirectMatch of Apache 2.2 mod_alias?

Posted on

What wrong with RedirectMatch of Apache 2.2 mod_alias? – Problems with loading a website are often blamed on the Internet connection, but even the most perfectly set up network cannot help if there is no service to reply at your destination. One of the most popular HTTP servers used for this task is Apache2. Much of Apache’s popularity can be attributed to its easy installation and use, but never the less it is possible to run into problems with even the easiest of the software. If you’ve encountered an issue loading your web page, follow these simple troubleshooting methods outlined in this guide to attempt to get your web server back up and working again. Below are some tips in manage your apache2 server when you find problem about apache-2.2, redirect, mod-alias, , .

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


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:


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:


Is it possible to create rule like below?

RedirectMatch (.*)(change_url=1 AND NOT type=do_not_redirect)(.*)  /keepurlprocess/$1

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


Leave a Reply

Your email address will not be published. Required fields are marked *