Rewrite Rules for Zen Cart Mods

Custom URLs and redirections.

Rewrite Rules for Zen Cart Mods

Postby BlessIsaacola » Sat Feb 09, 2008 10:27 am

Pasted below are some custom rewrite rules provided by ~J~ for some of Zen Cart Mods (About Us, Return Authorization and Testimonial (from Zencartbuilder) Mods).

add the following to your .htaccess file (the best location is to place this before the start of all the code generated by MSU for .htaccess)
Code: Select all
RewriteCond %{QUERY_STRING} ^currency=([a-zA-Z]{3})&zenid=([a-z0-9]*)$ [OR]
RewriteCond %{QUERY_STRING} ^currency=([a-zA-Z]{3})$ [OR]
RewriteCond %{QUERY_STRING} ^zenid=([a-z0-9]*)$ [OR]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^about-us.html$ index.php?main_page=about_us [L,QSA]

RewriteCond %{QUERY_STRING} ^currency=([a-zA-Z]{3})&zenid=([a-z0-9]*)$ [OR]
RewriteCond %{QUERY_STRING} ^currency=([a-zA-Z]{3})$ [OR]
RewriteCond %{QUERY_STRING} ^zenid=([a-z0-9]*)$ [OR]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^returns.html$ index.php?main_page=returns [L,QSA]

RewriteCond %{QUERY_STRING} ^currency=([a-zA-Z]{3})&zenid=([a-z0-9]*)$ [OR]
RewriteCond %{QUERY_STRING} ^currency=([a-zA-Z]{3})$ [OR]
RewriteCond %{QUERY_STRING} ^zenid=([a-z0-9]*)$ [OR]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^testimonials.html$ index.php?main_page=testimonials [L,QSA]


You can obviously use the same logic above for other links that are not automatically support by MSU. Once you add the above code to your .htaccess file, you want to make sure you change your link in your file to use the new MSU urls. For example chante http://www.yourdomain.com/index.php?mai ... stimonials to http://www.yourdomain.com/testimonials.html if you're using static link. You can see an example of this at http://www.clevershoppers.com (please look in the footer).
http://www.clevershoppers.com - Where Clever People Shop!
BlessIsaacola
Follower
 
Posts: 98
Joined: Sun Feb 03, 2008 8:48 pm
Location: Kennesaw, GA

Re: Rewrite Rules for Zen Cart Mods

Postby BlessIsaacola » Sat Apr 12, 2008 11:08 am

J or anyone else for that matter, can you please help with the rewrite code needed to make sure that the Zen Cart page gets automatically redirected.

For example I am using this code to reformat our About Us page:

Code: Select all
RewriteCond %{QUERY_STRING} ^currency=([a-zA-Z]{3})&zenid=([a-z0-9]*) [OR]
RewriteCond %{QUERY_STRING} ^currency=([a-zA-Z]{3}) [OR]
RewriteCond %{QUERY_STRING} ^zenid=([a-z0-9]*) [OR]
RewriteCond %{QUERY_STRING} ^
RewriteRule ^about-us.html$ index.php?main_page=about_us [L,QSA]


I then link to the page as http://www.clevershoppers.com/about-us.html

What I want to do is also have a rewrite in place so that if someone type http://www.clevershoppers.com/index.php ... e=about_us they are automatically redirected to http://www.clevershoppers.com/about-us.html

There are several pages that I want to apply this logic to. Please help.

Thanks!
http://www.clevershoppers.com - Where Clever People Shop!
BlessIsaacola
Follower
 
Posts: 98
Joined: Sun Feb 03, 2008 8:48 pm
Location: Kennesaw, GA

Re: Rewrite Rules for Zen Cart Mods

Postby ~J~ » Sat Apr 12, 2008 11:20 am

Code: Select all
RewriteRule ^index.php?main_page=about_us$ about-us.html [R=301,L,QSA]

RewriteCond %{QUERY_STRING} ^currency=([a-zA-Z]{3})&zenid=([a-z0-9]*) [OR]
RewriteCond %{QUERY_STRING} ^currency=([a-zA-Z]{3}) [OR]
RewriteCond %{QUERY_STRING} ^zenid=([a-z0-9]*) [OR]
RewriteCond %{QUERY_STRING} ^
RewriteRule ^about-us.html$ index.php?main_page=about_us [L,QSA]
Magic SEO URLs are now available for
osCommerce, CRE Loaded, Zen Cart, PrestaShop, OpenCart, CubeCart, phpBB and phpBB3!
~J~
InveoStore.com Founder
 
Posts: 1053
Joined: Sat Feb 02, 2008 11:07 am
Location: Prague, Central Europe

Re: Rewrite Rules for Zen Cart Mods

Postby BlessIsaacola » Tue Apr 15, 2008 6:12 am

Unfortunately this code did not work:
Code: Select all
RewriteRule ^index.php?main_page=about_us about-us.html [R=301,L,QSA]


Do I need a rewrite condition code before the rewrite rule you provided?

Thanks!
http://www.clevershoppers.com - Where Clever People Shop!
BlessIsaacola
Follower
 
Posts: 98
Joined: Sun Feb 03, 2008 8:48 pm
Location: Kennesaw, GA

Re: Rewrite Rules for Zen Cart Mods

Postby ~J~ » Tue Apr 15, 2008 6:22 am

No, you don't.
Magic SEO URLs are now available for
osCommerce, CRE Loaded, Zen Cart, PrestaShop, OpenCart, CubeCart, phpBB and phpBB3!
~J~
InveoStore.com Founder
 
Posts: 1053
Joined: Sat Feb 02, 2008 11:07 am
Location: Prague, Central Europe

Re: Rewrite Rules for Zen Cart Mods

Postby ~J~ » Sat May 03, 2008 3:17 am

BlessIsaacola wrote:Unfortunately this code did not work:


It should be:

Code: Select all
RewriteRule ^index.php?main_page=about_us$ about-us.html [R=301,L,QSA]
Magic SEO URLs are now available for
osCommerce, CRE Loaded, Zen Cart, PrestaShop, OpenCart, CubeCart, phpBB and phpBB3!
~J~
InveoStore.com Founder
 
Posts: 1053
Joined: Sat Feb 02, 2008 11:07 am
Location: Prague, Central Europe

Re: Rewrite Rules for Zen Cart Mods

Postby BlessIsaacola » Thu Jun 26, 2008 9:16 am

We've been noticing a lot of 404 errors relating to urls like this:

Thu Jun 26 12:38:50 2008] [error] [client 66.235.125.173] File does not exist: /public_html/software-10
[Thu Jun 26 12:32:26 2008] [error] [client 75.27.177.254] File does not exist: /public_html/games-11
[Thu Jun 26 12:28:16 2008] [error] [client 69.144.212.147] File does not exist: /public_html/dvd-videos-12
[Thu Jun 26 12:24:19 2008] [error] [client 79.70.70.148] File does not exist: /public_html/music-9

Basically these links are being accessed without the / added to the end of the category url.

Is it possible to have an automatic redirect of:
[Thu Jun 26 12:24:19 2008] [error] [client 79.70.70.148] File does not exist: /public_html/music-9

TO

[Thu Jun 26 12:24:19 2008] [error] [client 79.70.70.148] File does not exist: /public_html/music-9/


It looks like this 404 errors happens when someone is accessing our site using wireless devices like phones or webtv or internet access from satelitte.

I am just trying to brainstorm ideas of how to resolve this issue. I have a feeling it has something to do with how these devices are process base a href.
http://www.clevershoppers.com - Where Clever People Shop!
BlessIsaacola
Follower
 
Posts: 98
Joined: Sun Feb 03, 2008 8:48 pm
Location: Kennesaw, GA

Re: Rewrite Rules for Zen Cart Mods

Postby ~J~ » Thu Jun 26, 2008 10:51 am

Do you mean added URLs or URLs which are standard part of MSU? (in case of standard URLs, such redirections are supported for a long time, are you using latest MSU version?)
Magic SEO URLs are now available for
osCommerce, CRE Loaded, Zen Cart, PrestaShop, OpenCart, CubeCart, phpBB and phpBB3!
~J~
InveoStore.com Founder
 
Posts: 1053
Joined: Sat Feb 02, 2008 11:07 am
Location: Prague, Central Europe

Re: Rewrite Rules for Zen Cart Mods

Postby BlessIsaacola » Fri Jun 27, 2008 1:08 pm

J- I know that MSU supports that redirect and I am using the latest update of MSU which is why I am baffled that we are experiencing such 404 errors. I am NOT saying that this MSU problem but I will like to see if I can get to the bottom of this problem. Like I said, I see the error more with non-standard computer devices trying to access our site.
http://www.clevershoppers.com - Where Clever People Shop!
BlessIsaacola
Follower
 
Posts: 98
Joined: Sun Feb 03, 2008 8:48 pm
Location: Kennesaw, GA

Re: Rewrite Rules for Zen Cart Mods

Postby ~J~ » Fri Jun 27, 2008 3:53 pm

No idea what can be causing this. MSU send HTTP 301 Moved Permanently with no matter what user agent is used (including bots). How exactly looks line in error log?
Magic SEO URLs are now available for
osCommerce, CRE Loaded, Zen Cart, PrestaShop, OpenCart, CubeCart, phpBB and phpBB3!
~J~
InveoStore.com Founder
 
Posts: 1053
Joined: Sat Feb 02, 2008 11:07 am
Location: Prague, Central Europe

Next

Return to Custom Rewrite Rules

Who is online

Users browsing this forum: No registered users and 1 guest

cron