Hello,
I've tried reading through the numerous threads on redirects here, but now my head is spinning. Now I'm just confused even further!
First off, I'm not a stranger to htaccess rules, but since I only meddle with them about once a year, I'm certainly a novice. I'm using Apache 2.2
My issue:
I want to create a redirect for URLs such as these:
domain.com/directory/story.pl?num=2124422
domain.com/directory/story.pl?num=54118584
domain.com/directory/story.pl?num=658475
domain.com/directory/story.pl?num=1283026605
etc.
to point to domain.com/articles
Note that the parameter value is a variable. So I want any URL containing "domain.com/directory/story.pl?num=" to redirect to "domain.com/articles"
However, I want other parameters to redirect elsewhere. For example "domain.com/directory/story.pl?this=" to go to a specific URL, and "domain.com/directory/story.pl?that=" to go to another, etc.
So for the first rule, I was thinking something like this:
RewriteCond %{HTTP_HOST} ^domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteCond %{REQUEST_URI} ^/directory/story.pl
RewriteCond %{QUERY_STRING} ^num=xyz$
RewriteRule ^(.*)$ /articles? [R=301,L]
But it doesn't take into account the variable. Can I just replace "xyz" with "?" or is there a better way to do this?