Using mod ReWrite to redirect request with certain parameters.

Using mod ReWrite to redirect request with certain parameters.

am 23.10.2007 23:16:21 von Charles Crume

Hello;

I want to capture, and redirect, URLs that contain certain parameters (after
the ?). I have been reading a number of articles (web pages) on mod Rewrite,
but can't seem to get it working like I want.

For example, I want to redirect all URLs with "wxyz" in them, such as:

a.html?p1=123,p2=qwerty,wxyz=4
b.html?wxyz=def

Is what I want to do possible?

If so, can someone point me to an article (web page) or two that I can read?
(the pages I've found so far have not provided me the info I need.)

TIA.

Charles...

Re: Using mod ReWrite to redirect request with certain parameters.

am 24.10.2007 00:33:45 von Jim Hayter

Charles Crume wrote:
> Hello;
>
> I want to capture, and redirect, URLs that contain certain parameters (after
> the ?). I have been reading a number of articles (web pages) on mod Rewrite,
> but can't seem to get it working like I want.
>
> For example, I want to redirect all URLs with "wxyz" in them, such as:
>
> a.html?p1=123,p2=qwerty,wxyz=4
> b.html?wxyz=def
>
> Is what I want to do possible?
>
> If so, can someone point me to an article (web page) or two that I can read?
> (the pages I've found so far have not provided me the info I need.)

This can be done using mod_rewrite. The parameters after the ? are
known as the Query_string. Rewrite Rules can be written that are
conditional on query_string matching a regular expression:

RewriteCond %{QUERY_STRING} wxyz
RewriteRule (.*)

Re: Using mod ReWrite to redirect request with certain parameters.

am 25.10.2007 05:28:18 von Charles Crume

"Jim Hayter" wrote in message
news:13hstkiev3p6b41@news.supernews.com...

[snip]

>
> This can be done using mod_rewrite. The parameters after the ? are known
> as the Query_string. Rewrite Rules can be written that are conditional on
> query_string matching a regular expression:
>
> RewriteCond %{QUERY_STRING} wxyz
> RewriteRule (.*)

Thanks Jim;

I went back and scanned all my articles -- and there in one of them is the
mention of using {QUERY_STRING}. Looks like I missed it while trying to
absorb all the other info.

Thanks again.

Charles...