Welcome Guest, Not a member yet? Register   Sign In
pretty urls : wordpreess like
#1

[eluser]dianikol85[/eluser]
Hi to all!! Here is the thing.

Lets i have a product with

ID : 1
name : product_name

in order to view this products details i pass to the controller via an anchor link the id

anchor('product/ID', Product); You get the idea. it's a standard. what i need is that i want a clean url in the browser with product name instead of the id

for example

from

www.example/product/1

to

www.example/product/product-name

CI have some helpers to do create such strings but i am not sure how to pass it to the url for every product, The problem is i guess without the ID it may be confuse because i may have the same product name twice for example.


Any ideas?? Thanks in advance
#2

[eluser]Atharva[/eluser]
You can use
Code:
url_title()
function for url helper to have seo friendly product name. Regarding duplicate product names, you can have one separate field in db like 'seo_title' which will store seo friendly url for that product and which will be unique for all products. Using this field you will identify which product is being referred.
#3

[eluser]eoinmcg[/eluser]
an alternative method for dealing with duplicate url names
http://ellislab.com/forums/viewthread/125827/
#4

[eluser]dianikol85[/eluser]
Thanks. I just did an expirament in wordpress by adding two new posts with tha same article. Let's say "test"

In the second post it produced example.com/test-2

So the wp adds a unique seo-title in db i guess as Atharva said. I think i'll do the same by adding the inserted row id like this:

example.com/12-title

where 12 is the id.

Do you suggest something better than this?




Theme © iAndrew 2016 - Forum software by © MyBB