Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

URLS working in in /product and /cat/product


socom

Recommended Posts

Is there a way to get site working so we can shorten links with out having to set all products to /product and then having to 301 each product.

 

An example is there a way www.domain.com/product and www.domain.com/cat/product will both work? 

We have 

 

<link rel="canonical" href set up?

 

Thanks

Link to comment
Share on other sites

I may have misunderstood what you are trying to do, but you could just use a rewrite so the long url is the same as the short one.

Please backup before making any changes. Below is just an example of how this can be done.

 

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

# from /obj/task/profile/id/1568/username
# to /1568/username
RewriteRule ^obj/task/profile/id(/.+)$ /$1 [R=302,L,NC]

# from obj/task/page/city/41280/pageId/22/clubs//Test%20town
# to 41280/22/clubs//Test%20town
RewriteRule ^obj/task/page/city/([^/]+)/pageId(/.+?)/?$ /$1/$2 [R=302,L,NC,NE]

 

Link to comment
Share on other sites

Do none of the existing SEO add-ons do this for you? Are you looking for one that simply has a name (product or category) without a product ID, etc. so you could give a URL of domain.com/transparent-bleems or domain.com/visual-weapons, and have it rewrite to the right place (without an explicit rewrite in .htaccess for each)? I'm sure it can be done, but I can't think of anything for osC that already does this. You would have to send the outgoing product ID, etc. to a PHP routine that looks up the name in the database (from the product ID), and produces a URL of the desired form. You would have to send an incoming SEF URL to a PHP routine that looks up the names in a database and maps it to the usual /showproduct.php?pid=12345 etc. format. And of course, you have to maintain this database, whenever products and categories are added, deleted, or changed. I've seen this done for other applications, so I'm sure it's possible, but it will be far from trivial. Don't get caught in the trap of producing a URL for every single possible use -- just confine it to mapping a product ID to/from a product name, mapping a category ID to/from a category name, etc., and tack on other actions and commands in the normal manner.

Link to comment
Share on other sites

12 hours ago, MrPhil said:

Are you looking for one that simply has a name (product or category) without a product ID, etc. so you could give a URL of domain.com/transparent-bleems or domain.com/visual-weapons, and have it rewrite to the right place (without an explicit rewrite in .htaccess for each)? I'm sure it can be done, but I can't think of anything for osC that already does this.

There are 2 SEO URL add-ons doing this:

SEO-G   (not updated since time and not compatible with latest CE BS EDGE)

SEO Friendly Urls - a new approach (version for latest CE BS EDGE available, but multilanguage version is comercial)

and there was another comercial solution, not listed on the marketplace, which has discontinued support for oscommerce.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...