Example .htaccess
I have been working on a new example .htaccess file. It is working correctly in my test environments: Linux, PHP 5.2 and 5.3, Zen Cart 1.5.0 and 1.5.1.
The changes in this file are still in testing. If you have a working site with this plugin already, make sure you backup the existing .htaccess before trying the changes shown here.
Keep in mind after you change the .htaccess you may need to clear your browser cache to see everything in action. When changing some settings (such as "categories as directories") in the admin configuration you will need to edit the .htaccess and may wish to also reset the SEO Cache to see the changes immediately.
Added Support
Some performance enhancements, more exact matching, and better handling of 301s after changing settings in both the admin configuration and the .htaccess file.
Removed Support
This version of "Ultimate SEO URLs" does not support Zen Cart 1.3.x. The 1.3.x versions of "Ultimate SEO URLs" included in the .htaccess file examples for "Open Operations Info Manager" or "Dreamscape's News & Articles Manager". These have been removed from the .htaccess file because the plugins are not readily availability for Zen Cart 1.5.x.
File Contents
Code:
##### NOTE: Replace /shop/ with the relative web path of your catalog in the "Rewrite Base" line below:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /shop/
# Disable if using "Categories as Directories"
#RewriteRule ^(.*)-c-([0-9_]+)/(.*)-p-([0-9]+)\.html$ $3-p-$4\.html?cPath=$2&%{QUERY_STRING} [R=301,L]
# Enable only if using "Categories as Directories"
RewriteRule ^(.*)-c-([0-9_]+)/(.*)-p-([0-9]+)\.html$ index\.php?main_page=product_info&products_id=$4&cpath=$2&%{QUERY_STRING} [L]
# Normal operation Ultimate SEO URLs
RewriteRule ^(.*)-p-([0-9]+)\.html$ index\.php?main_page=product_info&products_id=$2&%{QUERY_STRING} [L]
# Disable if using "Categories as Directories"
#RewriteRule ^(.*)-c-([0-9_]+)\.html$ index\.php?main_page=index&cPath=$2&%{QUERY_STRING} [L]
#RewriteRule ^(.*)-c-([0-9_]+)/$ $1-c-$2\.html [R=301,L]
# Enable only if using "Categories as Directories"
RewriteRule ^(.*)-c-([0-9_]+)/?\.html$ $1-c-$2/ [R=301,L]
RewriteRule ^(.*)-c-([0-9_]+)$ %{REQUEST_URI}/ [R=301,L]
RewriteRule ^(.*)-c-([0-9_]+)/$ index\.php?main_page=index&cPath=$2&%{QUERY_STRING} [L]
# Normal operation Ultimate SEO URLs
RewriteRule ^(.*)-m-([0-9]+)\.html$ index\.php?main_page=index&manufacturers_id=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-pi-([0-9]+)\.html$ index\.php?main_page=popup_image&pID=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-pr-([0-9]+)\.html$ index\.php?main_page=product_reviews&products_id=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-pri-([0-9]+)\.html$ index\.php?main_page=product_reviews_info&products_id=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-ezp-([0-9]+)\.html$ index\.php?main_page=page&id=$2&%{QUERY_STRING} [L]
# All other pages
# Don't rewrite real files or directories
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*).html$ index\.php?main_page=$1&%{QUERY_STRING} [L]
# Handle when a resource is not found (404 Error Page)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index\.php?main_page=page_not_found&%{QUERY_STRING} [L]
Bookmarks