lucy24 - 8:04 pm on May 11, 2013 (gmt 0)
I've not seen an answer for this mass 301 redirect issue specifically
Well, no, you're not going to find a thread that says how to redirect the exact URL
to the exact URL
But there are hundreds of posts detailing RewriteRules that will do the trick.
If you already use mod_rewrite (RewriteRule by that name, regardless of what it does) then any redirects in the same htaccess also need to use mod_rewrite.
If not, you can use mod_alias in the RedirectMatch form. You need RedirectMatch (or RewriteRule) rather than simply Redirect because you'll be setting up a simple Regular Expression and capturing part of the request.
Based on your examples, it looks as if both types of redirect can be collapsed into a single rule.
redirect: /some-category/ID-some-product-name.html (e.g. /mens-sweat-shirts/1543-ichiban-fairly-offensive-sweat-in-grey.html)
to: /some-product-name (e.g. /ichiban-fairly-offensive-sweat-in-grey)
Was that cut short for faster typing, or are you really planning to go extensionless? If so, you will need a second rule or ruleset to go from the new URL to where the content really lives.
Come to that: Are you really changing-- or have you already changed-- the names of the physical files and directories? Or are you just changing the URLs?
A change in filename doesn't mean you have to change the URL. But if the end result is shorter and prettier, it's probably the right way to go.