Welcome Guest, Not a member yet? Register   Sign In
Permalinks for products without using id
#1

[eluser]0v3rth3d4wn[/eluser]
Hi! I'm trying to achieve the following in the site I'm building: I want to use unique urls for my products - http://www.mysite.com/en/my-cool-product instead of http://www.mysite.com/en/product/id. The unique identifier for the product is the id which is used to retrieve the information from the db.

Something that comes to my mind is that I can make an unique link for each product when adding a new product to the db by using let's say the brand and the product name - e.g. "nike-airmax".
The problem here is that this could be something not so unique because of other products having the same name. I thought of adding a color to the url - "nike-airmax-red" but my color field is not required so this one is out. I can do it by using the unique product id and make it like "nike-airmax-34".

So my unique url for each product will be "brand-model-id". This is something I can do but I'm trying something more SEO friendly. Can you give some advice on that?
#2

[eluser]Mauricio de Abreu Antunes[/eluser]
Ok, you need some valid identifier.
Number or string, you need. You can use your product name for this and let this field on database as unique. Why? It avoids some errors like "not unique key". I mean it is similar to slugs.
#3

[eluser]Aken[/eluser]
Your text URLs for products should be as unique as possible to differentiate between products. If you end up having two products that look like "nike-airmax", then those products should likely be combined into one product with multiple variations. Your variation URLs could be something like example.com/nike-airmax/red instead of including it in the actual key.

If you don't want to / can't handle that sort of thing, then your solution is fine. I personally would put the ID first followed by the text info. Then you can break apart the URL and search for the product by the ID.

One thing I'd recommend is take this example: example.com/shoes/23-nike-airmax-red-white
Chances are if someone put in this URL by hand: example.com/shoes/23 it would display the same product. You should check the full URL, and if the text doesn't exist, find the text that should be there and then redirect them to that URL using a 301 redirect. That will prevent duplicate URLs from showing up by mistake in search engines and stuff like that. Basically, you always want to sanitize and check the URL. Don't trust your users!




Theme © iAndrew 2016 - Forum software by © MyBB