in reply to Redirects with query string

The query string is separated from the URL before matching, as the docs clearly say:

What is matched?

The Pattern will initially be matched against the part of the URL after the hostname and port, and before the query string. If you wish to match against the hostname, port, or query string, use a RewriteCond with the %{HTTP_HOST}, %{SERVER_PORT}, or %{QUERY_STRING} variables respectively.

Replies are listed 'Best First'.
Re^2: Redirects with query string
by htmanning (Friar) on Dec 02, 2008 at 09:07 UTC
    I got this to work (in case anyone needs the same thing).
    RewriteEngine on RewriteCond %{QUERY_STRING} ^f=12 RewriteRule ^viewforum.php http://www.newdomain.com/forums [R=301]
    That makes anyone coming to

    http://www.mydomain.com/forums/viewforum.php?f=12

    get redirected to

    http://www.newdomain.com/forums.

      Nice work thanks. The only difference I but (.) in the end. RewriteRule ^viewforum.php http://www.newdomain.com/forums. [R=301] thanks