开发者

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

开发者 https://www.devze.com 2023-04-10 17:49 出处:网络
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

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号