I am using Commerce Product Url module for generating unique url for commerce products like follows,

For each product it provides id parameter,

  • mycommercesite.com/node/1?id=1
  • mycommercesite.com/node/1?id=2

as well as sku parameter,

  • mycommercesite.com/node/1?sku=pr1
  • mycommercesite.com/node/1?sku=pr2

But I need SEO friendly URL for each product

for example,

  • mycommercesite.com/node/1/product1
  • mycommercesite.com/node/1/product2

Is there any way to do this?


  • There is no pathauto integration? I don't use commerce much, but I was almost sure it integrates... Almost anything does, after all :)
    – Mołot
    Commented Dec 2, 2014 at 13:28
  • If my answer was useful please consider mark it with the green mark, otherwise anybody is gonna help you in other questions you have.
    – svelandiag
    Commented Dec 4, 2014 at 15:32
  • any ideas how to achieve this ?
    – mjs
    Commented Sep 19, 2016 at 11:07

1 Answer 1


the module Commerce product Url is for make unic urls based on product variations, it means when you have one product display showing different product variations.

Check this issue where they explain a little bit better what Im telling you

But there is a non-drupal solution to convert dinamic urls into SEO-friendly urls, that is using mod_rewrite:


Sad Original URL = site.com/node/1?id=54

Happy URL :) = site.com/node/1/rueben-sandwich/

Use mod_rewrite in your .htaccess file to parse out the elements of the URL. Like this:

RewriteEngine On //check that in drupal's .htaccess the rewrite engine is on by default

RewriteRule /(.*)/$ node/.*$?id=$1

the (.*) pulls the element out and puts it in variable $1. and the .*$ is just a wildcard that accepts everything after node/

Try it and tell us if it worked because I have not tried it with Drupal websites.

by the way, try to use sku, or some other argument in the url through the module configs, so your url would look better because using "id" the final result of the above code would be /node/1/54

  • Hi Thanks for your post. I can get your idea. But this will not be a permanent solution in my case.
    – Navane
    Commented Dec 5, 2014 at 10:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.