You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Michael Bellears <Mi...@staff.datafx.com.au> on 2005/06/07 06:49:45 UTC

[users@httpd] RedirectMatch regex question.

Wondering if someone can please assist with the following two
RedirectMatch regex's (My regex skills are zilch!)

RedirectMatch /main.cfm?=page&content&id=946
http://www.domain.com.au/privacy.html
RedirectMatch /main.cfm?page=unsubscribe
http://www.domain.com.au/unsubscribe/index.html

The ".", "?" , "&" + "=" signs probably need escape char in front of
them, but every combo I've tried fails miserably!

Thanks in advance.

Regards,
MB

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] RedirectMatch regex question.

Posted by Joshua Slive <js...@gmail.com>.
On 6/7/05, Michael Bellears <Mi...@staff.datafx.com.au> wrote:
> Wondering if someone can please assist with the following two
> RedirectMatch regex's (My regex skills are zilch!)
> 
> RedirectMatch /main.cfm?=page&content&id=946
> http://www.domain.com.au/privacy.html
> RedirectMatch /main.cfm?page=unsubscribe
> http://www.domain.com.au/unsubscribe/index.html
> 
> The ".", "?" , "&" + "=" signs probably need escape char in front of
> them, but every combo I've tried fails miserably!

Using mod_alias to deal with the query string is not, in general, a good idea.

Try mod_rewrite instead.  For your second Redirect, it would look
something like this:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^page=unsubscribe$
RewriteRule ^/main.cfm http://www.domain.com.au/unsubscribe/index.html [R]

But be sure to consult the mod_rewrite docs.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org