Mobile app version of vmapp.org
Login or Join
Shelley277

: Where is the best place for page's ID in a user friendly URL? I searched within the site but none where addressing exactly my question, So I ask it here: Which one of these structures for

@Shelley277

Posted in: #GoogleSearch #SearchEngines #Seo #Url #UserFriendly

I searched within the site but none where addressing exactly my question, So I ask it here:

Which one of these structures for a user-friendly url is the best with regards to search engines and user experience:

www.example.com/category/sub-category/sub-sub-category/article/ID

or

www.example.com/ID/category/sub-category/sub-sub-category/article

or perhaps:

www.example.com/category/ID/sub-category/sub-sub-category/article

In another word, Is it better to place id at the end of url or at the beginning, or maybe somewhere in the middle of it?

And another question: is it better to add a trailing slash to the end of the url?

To guess how long would be such the url the number of words in each section of the url are:


Category-name: 2 words
sub-category-name: 1 word
su-sub-category-name: 1-4 words (average 2 words)
article-namae: Average: 4 words


Thank you very much

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Shelley277

1 Comments

Sorted by latest first Latest Oldest Best

 

@Chiappetta492

There are two things you have to keep in your mind:


The easier to remember, the better
you have to be able to remove each part in the url without breaking it


This makes your 3 examples rather easy:

A www.example.com/category/sub-category/sub-sub-category/article/ID B www.example.com/ID/category/sub-category/sub-sub-category/article C www.example.com/category/ID/sub-category/sub-sub-category/article

The ID in B&C are too close to the domain. If you were to remove '/article' from the url, you would have to see the sub-sub-category page. The product's ID no longer makes any sense now.

That leaves A. Rule 1 fails here (you should be able to remove /ID from the url), but there is a easy fix:
www.example.com/category/sub-category/sub-sub-category/article-ID

I've replaced the last slash with a dash. You can easily take the id with something like:

$pid = substr($url, strrpos($url,'-')+1); // find the last dash


You can't use explode here and take the last value, it would break with /example-string-123. Wether you use id-name or name-id doesn't really matter.



Offtopic: I'd keep the url structure A, but the url to the product I try to make very short:

A www.example.com/article-ID B www.example.com/ID-article C www.example.com/Brandname-article-ID

If the product would change category, the url remains the same. Less dead links, less to worry about and shorter urls are (often) better. If you want to make the distinction a bit more easy for the code could append .htm after the url, for products only.

This allows you to display products multiple times if they fit multiple criteria. Say you have an awesome blue tshirt (ABT), you could display ABT on the /blue-stuff and /t-shirts overviews.
This is just my preference after some years of experience.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme