htaccess

Posts: 49
Joined: 08/17/2007
Getting busy with the Ubercode.Spreading the word - Ubercart for president.

One other thing I wanted to document here since it took me some time to figure it out. Since I didn't want to break my links in search engines to each of my products which were in OSCommerce, I put in redirects from my old oscommerce product pages to my new ubercart product pages into my .htaccess file. But it wasn't as straight forward as I though because the oscommerce product pages are written in the following way:

http://www.mysite.com/productinfo.php?products_id=1234

Using a simple redirect like this:

Redirect 301 /productinfo.php?products_id=1234 http://www.mysite.com/magazine/time

does not work because of the question mark/query in the original url. So the way I needed to do it to get it work was like this below:

RewriteEngine on
RewriteCond %{QUERY_STRING} products_id=1234
RewriteRule ^product_info\.php$ /magazine/time? [R=301,L]

Hope that helps for folks migrating from Oscommerce to Ubercart.