Easy search URL

Years ago I did a mod rewrite for my old (and current) shopping cart. Essentially I am looking for a quick guide on how to make an easy to read, short url for a search term.



www.mysite.com/oldcart/searchterm Gives results of the word “searchterm” if I type that in my browser. Here is what I have written for the old cart for it to work:


RewriteEngine on


Options +FollowSymLinks


RewriteBase /


RewriteRule ^(.*)oldcart/(.*)$ $1cgi-bin/oldcart.cgi?keywords=$2




The 2 questions I have are:

  1. How do I do this for CS? I’m not that smart when it comes to coding stuff like this.
  2. Will adding the code for CS in my htaccess file cause any issues with my current cart? It’s still live so I want to keep it that way and I’m not sure how these rewrites function.

No one?



I’m getting close using mod_rewrite generators but my results aren’t exactly what I want. With the proper url showing it is only searching my category names and it has to be exact. So mysite.com/cart/dog doesn’t show up anything because the category name is “Dog Decals”. But mysite.com/cart/mouse will bring up the mouse category. The problem is I am not looking for the link to work only with categories…I need it to search for all related terms in any product (so description, keywords, category names, etc.)



Can someone look at the code and see what I am doing wrong? Below is an example for what it would search for using the term “mouse”. I would like my url to be mysite.com/shop/mouse. This should give results like if I did a general search on the site for the term “mouse”.


# Enable Rewrite Engine
RewriteEngine on

#Create friendly URL
RewriteRule ^shop/mouse$ shop/index.php?subcats=Y&type=extended&status=A&pshort=Y&pfull=Y&pname=Y&pkeywords=Y&cid=0&q=mouse&x=0&y=0&dispatch=products.search [L]

[quote name=‘IsItFast’]Years ago I did a mod rewrite for my old (and current) shopping cart. Essentially I am looking for a quick guide on how to make an easy to read, short url for a search term.



www.mysite.com/oldcart/searchterm Gives results of the word “searchterm” if I type that in my browser. Here is what I have written for the old cart for it to work:


RewriteEngine on


Options +FollowSymLinks


RewriteBase /


RewriteRule ^(.*)oldcart/(.*)$ $1cgi-bin/oldcart.cgi?keywords=$2
The 2 questions I have are:

  1. How do I do this for CS? I’m not that smart when it comes to coding stuff like this.
  2. Will adding the code for CS in my htaccess file cause any issues with my current cart? It’s still live so I want to keep it that way and I’m not sure how these rewrites function.[/quote]



    You must redirect each important old url to a new one with 301 in the htaccess.

[quote name=‘IsItFast’]No one?



I’m getting close using mod_rewrite generators but my results aren’t exactly what I want. With the proper url showing it is only searching my category names and it has to be exact. So mysite.com/cart/dog doesn’t show up anything because the category name is “Dog Decals”. But mysite.com/cart/mouse will bring up the mouse category. The problem is I am not looking for the link to work only with categories…I need it to search for all related terms in any product (so description, keywords, category names, etc.)



Can someone look at the code and see what I am doing wrong? Below is an example for what it would search for using the term “mouse”. I would like my url to be mysite.com/shop/mouse. This should give results like if I did a general search on the site for the term “mouse”.


# Enable Rewrite Engine
RewriteEngine on

#Create friendly URL
RewriteRule ^shop/mouse$ shop/index.php?subcats=Y&type=extended&status=A&pshort=Y&pfull=Y&pname=Y&pkeywords=Y&cid=0&q=mouse&x=0&y=0&dispatch=products.search [L]
[/quote]



I think, you use the code in reverse order.

Yes, I do understand I need to redirect the old urls…but right now I’m just wanting to get my CS cart urls to be easy to read like my old ones. Once I have the new urls the way they need to be I can start redirecting to them.

Well still no luck. I even tried posting over at webmasterworld without any simple explanation to why it isn’t working. I can’t believe no one on here has never done a rewrite like this as using the short urls within my old cart puts me at the top on Yahoo and Bing for most related search terms. It seems it would be beneficial to all.



I’m trying to figure it out but when you have no clue on how this stuff works it starts to hurt my head.



Here is a more easy to read rule since it doesn’t have the term “mouse” in it. It still gives the same results of just going to that category name; not the general search I am looking for. Maybe that will help:


RewriteRule ^([^/]*)$ /shop/index.php?subcats=Y&type=extended&status=A&pshort=Y&pfull=Y&pname=Y&pkeywords=Y&cid=0&q=$1&x=0&y=0&dispatch=products.search [L]

I just noticed that the cart defaults to the actions above even without a rewrite rule. I removed the rule and it still goes to the category if there is one with the name you type in. Odd…



And as an update: I just went ahead and paid the CS techs to get this to work the way I wanted it to.