Greetings!

Our Drupal-based site (www.fuhnee.com) has a taxonomy called "Tags". It used to be called "Keywords". When I renamed the taxonomy, people who had bookmarked some pages got "Not Found" errors. I want to remedy that with a 301 redirect that covers all the possible bookmarked pages.

Old pages were of the form /keywords/boat.html -- which took you to a taxonomy-based listing page.

New pages are be of the form /tags/boat.html.

You'd think the redirect (in .htaccess) would look like this:

Redirect 301 /keywords http://fuhnee.com/tags

or

RedirectMatch 301 /keywords/(.*)\.html$ http://fuhnee.com/tags/$1.html

but neither works. If I use those, I get this resulting URL:

http://fuhnee.com/tags/boat.html?q=keywords/boat.html

Where the heck does the ?q=keywords/boat.html part come from?? And how to get rid of it?

Your help is sincerely apprecitated!

(PS: In IE, I get Page Not Found. In Firefox, it seems to ignore the ?q= part and still works!)

Comments

ardee-1’s picture

The "?q=" stuff was coming from the Clean URLs feature (RewriteCond and RewriteRule calls) already in the .htaccess file. Using RedirectMatch didn't mix well with those, whether placed earlier or later in the file.

Instead, before the Clean URLs conditions/rules in the .htaccess file, I put this:

RewriteRule ^keywords/(.*)\.html$ /tags/$1.html [R=301,L]

This seems to work. I guess the lesson is this:

If your .htaccess uses RewriteCond and/or RewriteRule calls, you should avoid using Redirect or RedirectMatch and instead use additional RewriteCond and/or RewriteRule calls.