Forum Moderators: phranque

Message Too Old, No Replies

Rewriting with query parameters ignored

htaccess rewrite

         

vvvmmm2

1:28 am on Dec 19, 2009 (gmt 0)

10+ Year Member



I am trying to comeup with reqrite logic for the forum that I am moving
I have forum with urls:
[mydomain.com...]
[mydomain.com...]

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!

jdMorgan

1:34 am on Dec 19, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



mod_alias is a very old module, and it's not even aware of query strings appended to URLs...

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

vvvmmm2

1:45 am on Dec 19, 2009 (gmt 0)

10+ Year Member



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 :-(.

vvvmmm2

2:59 am on Dec 19, 2009 (gmt 0)

10+ Year Member



I gave up. It is just too hard for me to figure out. I'll leave my forums as it is, there will be less hits and users will be confused, but I think they'll live.

Thanks again for your attempt to help.