We recently migrated our ecommerce site from one cart to another. The old cart had .aspx file extensions, the new one has a 3rd party SEO module that rewrites product page urls with .html and no extention on category pages (categories end with a forward slash). Our .htaccess file has the "RewriteEngine On" command to support the 3rd party mod.
I added a couple of redirect 301 commands to test my ability to redirect some of the old site urls to the new site. This is an example of one I added.
redirect 301 /apple-accessory-C92.aspx http://www.example.com/apple-accessory/
The redirects work great but I have thousands to redirect, so I have been researching forum posts for a solution. While trying to come up with a general expression to redirect additional pages from the old site to the new, I found an recent post that said it is not good practice to have both RewriteRule and Redirect commands in the same htaccess file.
So, I tried
RewriteRule /apple-accessory-C92.aspx http://www.example.com/apple-accessory/ [R=301]
This did not work, and instead of redirecting to the /apple-accessory/ url it goes to my 404 page. I also tried to use a regular expression based on what I found in the forums. A typical product url from the old site looks like this...
www.example.com/apple-accessory-P10023.aspx
I want all the products with "apple-accessory-" in the url to be directed to the /apple-accessory/ category page. I tried the following redirect statement, but like my example above, I get redirected to the 404 error page.
RewriteRule /apple-accessory-.*\.aspx http://www.example.com/apple-accessory/
This is my first attempt at a regular expression and so far, no luck. Any suggestions would be greatly appreciated.
My apologies for such a long post, I hope I do not wear out my welcome on post 1.
[edited by: jdMorgan at 4:40 pm (utc) on Mar 1, 2010]
[edit reason] Please use example.com [/edit]