How to use a product title in the URL?

Asked

Viewed 178 times

0

For example I have a page where I list the products : http://exemplo.com/produtos.php and when clicking on any of the products listed the URL is http://exemplo.com/produtos.php?id=2.

Assuming the product of id=2 hold a title Relógio Patek Philippe 1928, how to change the URL so that instead of http://exemplo.com/produtos.php?id=2 stay http://exemplo.com/produtos/Relógio-Patek-Philippe-1928 as it happens here in Sopt ?

  • 1

    Here is an explanation of how to do http://answall.com/questions/53973/url-amig%C3%A1vel-como-fazer-funcionar-com-htaccess

  • mass in a had seen I’ll take a look see if meets...vlw man.

  • 1

    you would first have to make a Slug of the product name: http://stackoverflow.com/questions/19335215/what-is-a-slug then add a column to that table (of product) slug and put there... and then instead of searching (SELECT, SQL) where the id=2 (ex) search where slug=Relógio-Patek-Philippe-1928. Note that this way you have to ensure that slugs are also unique

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.