.htaccess modification for SEO
Posted: Thu Jun 12, 2008 10:02 am
Hi guys,
Here's my issue. A client of mine has had their eCommerce store up and running for around a year now, using the popular OpenSource software ZenCart.
I've installed the module Ultimate SEO URLs on a test site which takes the dynamic URLs generated by the ZenCart engine and uses a .htaccess file to transform them into static URLs. The main advantage being for doing this is they can add all of their products to GoogleBase.
So far I have the module working, but the URL still contains the product's ID, which is dynamic. This will not work for GoogleBase, as the products for the shop are generated by a Tab-Delimited File and therefore the ID's will change everytime a new file is sent to me.
Here is the code for the .htaccess:
It is mainly the 5th line which I have been playing around with. Below is an example of what it does to the URL
FROM:
TO:
As you can see, it works (and works well) but I really need to get rid of the 'p-216' (p-product_id) so it will be perfect.
Also, before anyone says it, yes I have posted on the ZenCart forums, and no I don't have a response as of yet.
Does anyone know how to go about doing this? There is also a class file which is supplied, so it may be something to do with that aswell.
Until then, I shall continue to see if I can do this myself, but any help would be greatly appreciated.
Thanks for reading!
Here's my issue. A client of mine has had their eCommerce store up and running for around a year now, using the popular OpenSource software ZenCart.
I've installed the module Ultimate SEO URLs on a test site which takes the dynamic URLs generated by the ZenCart engine and uses a .htaccess file to transform them into static URLs. The main advantage being for doing this is they can add all of their products to GoogleBase.
So far I have the module working, but the URL still contains the product's ID, which is dynamic. This will not work for GoogleBase, as the products for the shop are generated by a Tab-Delimited File and therefore the ID's will change everytime a new file is sent to me.
Here is the code for the .htaccess:
Code: Select all
Options +FollowSymLinks
RewriteEngine On
# RewriteBase /zentest/
# From Ultimate SEO URLs
RewriteRule ^(.*)-p-(.*).html$ index\.php?main_page=product_info&products_id=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-c-(.*).html$ index\.php?main_page=index&cPath=$2&%{QUERY_STRING} [L]
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]
# For Open Operations Info Manager
RewriteRule ^(.*)-i-([0-9]+).html$ index\.php?main_page=info_manager&pages_id=$2&%{QUERY_STRING} [L]
# For dreamscape's News & Articles Manager
RewriteRule ^news/?$ index\.php?main_page=news&%{QUERY_STRING} [L]
RewriteRule ^news/rss.xml$ index\.php?main_page=news_rss&%{QUERY_STRING} [L]
RewriteRule ^news/archive/?$ index\.php?main_page=news_archive&%{QUERY_STRING} [L]
RewriteRule ^news/([0-9]{4})-([0-9]{2})-([0-9]{2}).html$ index\.php?main_page=news&date=$1-$2-$3&%{QUERY_STRING} [L]
RewriteRule ^news/archive/([0-9]{4})-([0-9]{2}).html$ index\.php?main_page=news_archive&date=$1-$2&%{QUERY_STRING} [L]
RewriteRule ^news/(.*)-a-([0-9]+)-comments.html$ index\.php?main_page=news_comments&article_id=$2&%{QUERY_STRING} [L]
RewriteRule ^news/(.*)-a-([0-9]+).html$ index\.php?main_page=news_article&article_id=$2&%{QUERY_STRING} [L]
# All other pages
# Don't rewrite real files or directories
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*).html$ index\.php?main_page=$1&%{QUERY_STRING} [L]
FROM:
Code: Select all
http://www.example.com/index.php?main_p ... s_id=14161Code: Select all
http://www.example.com/100g-nescafe-coffee-p-216.htmlAlso, before anyone says it, yes I have posted on the ZenCart forums, and no I don't have a response as of yet.
Does anyone know how to go about doing this? There is also a class file which is supplied, so it may be something to do with that aswell.
Until then, I shall continue to see if I can do this myself, but any help would be greatly appreciated.
Thanks for reading!