Forum Moderators: phranque
RewriteEngine On
# Index Redirect for /zencart/index.php URL with no parameters
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /zencart/index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.example.com/? [R=301,L]
# Index Redirect for /zencart/(index.php)?main_page=index(&cPath=<blank>) URL
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /zencart/(index\.php)?\?main_page=index(&cPath=)?\ HTTP/
RewriteRule ^(index\.php)?$ http://www.example.com/? [R=301,L]
# Canonical Redirect all /zencart/<something> URL requests to root in www
RewriteRule (.*) http://www.example.com/$1 [R=301,L] # ErrorDocument
ErrorDocument 404 /index.php?main_page=page_not_found
RewriteEngine On
# Index Redirect for /index.php with no parameters
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.example.com/? [R=301,L]
# Index Redirect for /(index.php)?main_page=index(&cPath=<blank>) URL
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(index\.php)?\?main_page=index(&cPath=)?\ HTTP/
RewriteRule ^(index\.php)?$ http://www.example.com/? [R=301,L]
# Canonical Redirect non-www to www [EXCLUDE /admin and /zencart URL requests]
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteCond %{REQUEST_URI} !^/(admin|zencart) [NC]
RewriteRule (.*) http://www.example.com/$1 [R=301,L]