RedirectMatch, mod_rewrite, and question marks, oh my! Please help me redirect to urls with question marks in them.
I've got a web site hosted on an apache server, I'm not a Unix guy, and I need some syntax help.
I would like to redirect a list of urls to a list of other urls. I want to have a bunch of RedirectMatch statements in my .htaccess file. Unfortunately, the new urls have question marks in them.
What I want is something that would work like this (for about 200 different urls):
RedirectMatch permanent ^/archives/000127.html$ http://www.example.com/?p=129
Googling has taught me that RedirectMatch chokes on the question marks because it interprets it like a regex (or something like that).
This thread makes me think that I can do something with RewriteCond, RewriteRule or the like. I don't quite understand how to implement the solution mentioned in the above mentioned thread:
RewriteCond %{QUERY_STRING} ^topic=(.*)$
RewriteRule ^index\.php$ /topic/%1? [R=301,L]
Can one of you Apache experts provide a snippet of what my .htaccess file would have to include. I don't know if the RewriteRule and RewriteCond lines need to happen only once, before the list of RedirectMatch lines, or if it has to occur before each one. If you could give me an example that would redirect two different urls to two new ones, I could then implement it.
(I apparently cannot use Redirect, I need to use RedirectMatch)
posted by boaz at 11:41 AM on December 31, 2005