christymreed:
... The issue I'm having is because the two sites were not identical. They were independent of each other. One site has existed since 2006 and is well established in the search engines. ... The new site has been running for about a year but products were entered differently and the cart is not in the same folder as the older site. So I'm not really moving the entire site, I'm rather killing the cart but I want the domain to redirect to the new domain. ...
As you noted - if the old and new sites do not share the same URI path + query + fragment, one cannot use a generic RewriteRule. In this case each old <=> new page mapping will need a custom redirect (or RewriteRule).
A URL is a type of uniform resource identifier (URI). Quick Example (not meant to be exhaustive or complete):
http://www.zen-cart.com/showthread.php?208441-Redirect-to-a-new-domain&p=1206124#post1206124
Some Components of the above URI.
[B]name:[/B] http
[B]authority:[/B] www.zen-cart.com
[B]path:[/B] /showthread.php
[B]query:[/B] 208441-Redirect-to-a-new-domain&p=1206124
[B]fragment:[/B] post1206124
Redirecting a URL based upon query components is complicated (default Zen Cart URLs contain these). Under Apache this can be done using RewriteRules.
# This .htaccess file should be in the document root of the old server.
# Assumes the old server will be sticking around for a suitable amount of time.
# Suitable when website forwarding does not pass URI paths or queries.
# Enable mod_rewrite
RewriteEngine on
# Zen Cart Category Example (old cPath of 1 and new cPath of 4)
RewriteCond %{QUERY_STRING} (^|&)main_page=index($|&)
RewriteCond %{QUERY_STRING} (^|&)cPath=1($|&)
RewriteRule ^/?index\.php$ http://www.newsite.com/store/index.php?main_page=index&cPath=4 [L,R=301]
# Zen Cart Product Example (old product 1 in category 1_4 and new product of 4 in category 1_5)
RewriteCond %{QUERY_STRING} (^|&)main_page=product_info($|&)
RewriteCond %{QUERY_STRING} (^|&)cPath=1_4($|&)
RewriteCond %{QUERY_STRING} (^|&)products_id=1($|&)
RewriteRule ^/?index\.php$ http://www.newsite.com/store/index.php?main_page=product_info&cPath=1_5&products_id=4 [L,R=301]
# This .htaccess file should be in the document root of the new server.
# Assumes the old server will not be sticking around.
# Suitable when website forwarding does pass URI paths or queries.
# Enable mod_rewrite
RewriteEngine on
# Zen Cart Category Example (old cPath of 1 and new cPath of 4)
RewriteCond %{HTTP_HOST} ^(www\.)?oldsite\.com$
RewriteCond %{QUERY_STRING} (^|&)main_page=index($|&)
RewriteCond %{QUERY_STRING} (^|&)cPath=1($|&)
RewriteRule ^/?index\.php$ http://www.newsite.com/store/index.php?main_page=index&cPath=4 [L,R=301]
# Zen Cart Product Example (old product 1 in category 1_4 and new product of 4 in category 1_5)
RewriteCond %{HTTP_HOST} ^(www\.)?oldsite\.com$
RewriteCond %{QUERY_STRING} (^|&)main_page=product_info($|&)
RewriteCond %{QUERY_STRING} (^|&)cPath=1_4($|&)
RewriteCond %{QUERY_STRING} (^|&)products_id=1($|&)
RewriteRule ^/?index\.php$ http://www.newsite.com/store/index.php?main_page=product_info&cPath=1_5&products_id=4 [L,R=301]
The glass is not half full. The glass is not half empty. The glass is simply too big!
Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker