socom Posted January 3, 2019 Share Posted January 3, 2019 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 More sharing options...
♥raiwa Posted January 3, 2019 Share Posted January 3, 2019 About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
♥JcMagpie Posted January 3, 2019 Share Posted January 3, 2019 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 More sharing options...
MrPhil Posted January 3, 2019 Share Posted January 3, 2019 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 More sharing options...
♥raiwa Posted January 4, 2019 Share Posted January 4, 2019 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. About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
socom Posted January 4, 2019 Author Share Posted January 4, 2019 Thanks i will have a look through those mods see if it can be done without killing current urls Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.