User Tools

Site Tools


redirect_links_from_another_platform

Redirect Links From Another Platform

Assuming you have migrated your products to LiteCart from another platform assigning the same IDs. Here are some good mod_rewrite rules for telling Google and others your pages have moved.

OpenCart

/.htaccess
  # Redirect old OpenCart URLs
  RewriteCond %{QUERY_STRING} route=product/category
  RewriteCond %{QUERY_STRING} path=([0-9]+_)?([0-9]+)
  RewriteRule ^index\.php$ /index.php/category?category_id=%2 [R=301,L]
 
  RewriteCond %{QUERY_STRING} route=product/manufacturer/info
  RewriteCond %{QUERY_STRING} manufacturer_id=([0-9]+)
  RewriteRule ^index\.php$ /index.php/manufacturer?manufacturer_id=%1 [R=301,L]
 
  RewriteCond %{QUERY_STRING} route=product/product
  RewriteCond %{QUERY_STRING} product_id=([0-9]+)
  RewriteRule ^index\.php$ /index.php/product?product_id=%1 [R=301,L]

osCommerce

/.htaccess
  # Redirect old osCommerce URLs
  RewriteCond %{REQUEST_URI} ^(/|/index.php) [NC]
  RewriteCond %{QUERY_STRING} cPath=([0-9]+)
  RewriteRule .* /index.php/category?category_id=%1 [R=301,L]
  RewriteRule ^.*-c-([0-9]+)\.html$ /index.php/category?category_id=$1 [R=301,L]
 
  RewriteCond %{REQUEST_URI} ^(/|/index.php) [NC]
  RewriteCond %{QUERY_STRING} manufacturers_id=([0-9]+)
  RewriteRule (.*) /index.php/manufacturer?manufacturer_id=%1 [R=301,L]
  RewriteRule ^.*-m-([0-9]+)\.html$ /index.php/manufacturer?manufacturer_id=$1 [R=301,L]
 
  RewriteCond %{REQUEST_URI} ^/product_info.php [NC]
  RewriteCond %{QUERY_STRING} products_id=([0-9]+)
  RewriteRule (.*) /index.php/product?product_id=%1 [R=301,L]
  RewriteRule ^.*-p-([0-9]+)\.html$ /index.php/product?product_id=$1 [R=301,L]

Be sure to add the rules before:

  # No logic for physical files
  RewriteCond %{REQUEST_FILENAME} -d [or]
  RewriteCond %{REQUEST_FILENAME} -f
  RewriteRule ^ - [L]
redirect_links_from_another_platform.txt · Last modified: 2020/08/04 08:22 by A User Not Logged in