Forum Moderators: phranque
I want to add to htaccess file rewrite condition that all links that come to f=3 goes to one URL, eveything that links to forum 4 goes to another URL.
so after mapping following URLS shoul point to forum/new1.html (I do not need to track original parameters, as I am redirecting all old posts to single forum)
[mydomain.com...]
[mydomain.com...]
[mydomain.com...]
These all should point to the same link:
[mydomain...]
I attempted to do this:
#RedirectMatch 301 ^/forum/viewforum.php?f=3(.*) [mydomain...]
#RedirectMatch 301 ^/forum/viewforum.php?f=4(.*) [mydomain...]
My redirect does not work, as clearly part ?f=3 is ignored.
Could you please help me figure this out?
Thank you!
You'll need to use mod_rewrite, and further, you'll need to use a RewriteCond to test the query strings appended to your URLs, as they are considered to be separate things.
There are lots of examples of query-string rewriting and redirection in this forum... Try the site search facility (link at top of screen) with words like "RewriteCond QUERY_STRING" to turn up lots of relevant threads.
Jim
Thank you for such a quick reply. I tried your search, but every explanation assumes that I know expressions and generally RewriteCond syntax. Unfortunatelly I don't. Just by looking at examples I cannot figure out what is required for my case. I am trying to learn RewriteCond sytax, but it will take me few nights to figure out :-(.