url rewriting - Implement friendly URLs with product name -
i'm working on e-commerce site following url format individual products:
examplesite.com/shop.php?sec=prod&prod=373
where 373 individual product number. rewrite product urls this:
examplesite.com/product-name-here
unfortunately, of product names contain characters such *, / , !, should not included in url.
i have access everything, limited skills, please assume i'm naive if answer!
thanks!
using unique slugs ('product-name-here') tricky sometimes. it's better have this:
examplesite.com/373/product-name-here.html // or examplesite.com/373-product-name-here
... or other combination, keep product id in url. create slugs, google php slug generator
if you're running server apache, need load mod_rewrite module , add .htaccess root of project (there execute index.php)
rewriteengine on options followsymlinks # examplesite.com/373/product-name-here.html rewriterule ^([0-9]*)/([a-za-z0-9+-_\.])\.html$ shop.php?sec=prod&prod=$1
Comments
Post a Comment