Drupal Commerce 产品 URL 优化 SEO

五迷三道 提交于 2020-03-01 02:30:20

https://www.drupal.org/project/commerce_product_urls
For each product it provides id parameter, for example:

http://www.mycommercesite.com/node/1?id=1
http://www.mycommercesite.com/node/1?id=2

as well as sku parameter, for example:

http://www.mycommercesite.com/node/1?sku=pr1
http://www.mycommercesite.com/node/1?sku=pr2

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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!