ZenCart - Shorten URLs Tutorial Tweaks
Moderators: adafruit_support_bill, adafruit

Forum rules
Get help, and assist others in with open source kits and running a business! Do not ask for legal advice or for consulting services in this forum, only general biz questions!
Please be positive and constructive with your questions and comments.

ZenCart - Shorten URLs Tutorial Tweaks

by presence on Sat Feb 18, 2012 9:53 pm

I've slipped together a stock ZenCart 1.5.0 installation and the "Shorten and Pretify URLs" tutorial easily, but ran into a minor hangup.
Tutorial at: http://www.ladyada.net/library/zencart/niceurl.html

ZenCart's links for "All Products" and "New Products" are created nicely with the code modification in includes/functions/html_output.php
The bummer is that the tutorial's current .htaccess rewrite example doesn't translate the nice short & simple "New" and "All" links back into ZenCartian.

Copypasta these additional lines into .htaccess and all seems peachy:
Code: Select all | TOGGLE FULL SIZE
#redirect old products_all
RewriteCond %{QUERY_STRING} ^main_page=products_all$
RewriteRule ^index.php$ /all? [R=301]

#redirect old products_new
RewriteCond %{QUERY_STRING} ^main_page=products_new$
RewriteRule ^index.php$ /new? [R=301]

#rewrite back to the old page
RewriteRule ^all/ index.php?hidden=yes&main_page=products_all [QSA,L]
RewriteRule ^new/ index.php?hidden=yes&main_page=products_new [QSA,L]

Think that's all there was to it, but if anyone has suggestions to make more efficient or any other .htaccess rewrites that help ZenCart along, please share!

Posts: 11
Joined: Wed Apr 29, 2009 8:37 pm
Location: Las Vegas, NV

Please be positive and constructive with your questions and comments.