gremo
gremo

Reputation: 48477

SEO optimization url and routes, deal with not unique parameters?

Everyone knows that:

www.example.com/city/new-york

is much better than:

www.example.com/city?id=43567

Fine, meaningful and human-readable. But how to deal with slug or not unique names (e.g. the city of Naples in both Italy and USA)?

What i mean is that when the user click on that link i should query the database for the city: i can't use the slug new-work as it's not unique and the function for calculating the slug is not invertible.

Question: should i store the slug in the database for the purpose of url generating or should i append the id after/before the city slug? Which method is better from SEO point of view? Does any other way exist?

www.example.com/city/43567/naples
www.example.com/city/naples-43567

Upvotes: 1

Views: 226

Answers (1)

John Conde
John Conde

Reputation: 219924

Do what this website does and put the ID first and slug second. That way if the slug is lost or entered incorrectly the URL still works.

As far as SEO goes one isn't substantially better then the other.

Upvotes: 1

Related Questions