I don't think there is a definitive answer to this, but I would like to get people's opinions on the best way to pass parameters, i.e. via the query string, or part of the main url, or cookies, or a combination. I'm interested not only from the SEO perspective, but also the user experience perspective.
Given the following parameters:
You could have a URL such as:
sortBy and sortOrder do not necessarily have to be included in the URL at all - a user is likely to set their sorting preference once, and then expect it to be honoured for all future page views, so these parameters can be delivered via cookie rather than the URL. However, this could then cause problems for people sharing links. If a user has changed the sortOrder, then sends the link to a friend, the friend would not see the same info - page 2 of shoes sorted by date might be quite different from page 2 of shoes sorted in the default order of price.
According to Google, they prefer parameters in the query string as they find these easier to parse: Google Webmaster blog - Dynamic URLs vs. static URLs. If using query string parameters, this also allows you to specify the parameters in Google Webmaster tools (and I think in Bing webmaster tools as well).
As far as user experience goes, including the categoryName value in the url rather than (or as well as) a category id is a given. So long as you are doing that, I don't think there would be much difference between the different methods really. Possibly the need for the query string to contain 'categoryName' isn't as friendly as only including the actual categoryName value, as well as making the query string approach slightly longer. The cookie approach makes the url nice and short but doesn't give the user any indication of what sort method or order they are using, which is a negative.
There is an interesting article by Tim Berners-Lee on how a URL should be constructed here: Cool URIs don't change. However, he doesn't really address parameters, and his suggestions (put a date in front of everything) seem to more suited to documents and articles than dynamic web pages.
Looking at what other sites use:
- Amazon seem to use the category name, followed by some parameters written as part of the address, followed by a long query string, e.g.
- Wordpress meanwhile tends to use URLs with the parameters as part of the address, e.g. domain.com/category/shoes/page/2/
- Facebook uses a combination of parameters as part of the address and a query string, e.g. facebook.com/facebook?sk=wall
My own inclination is to use something like
This is relatively easy for a user to understand in my opinion, and the query string parameters can be left off for the default view, and just added if the user changes the sortBy, sortOrder, or page. Keeping the non-essential parameters as query string parameters should also make google happy.
It is not a 'forever' url i.e. If I posted the link today, in two months the content may be completely different as items are added to and removed from the category, but I don't see any way round this.
I would be interested to hear what url structure you prefer, and why.
If it's a url with more than 2 parameters, i'll choose second variant, with index.php?...
If there is only one ore two parameters, i'll use the first variant, with '/', or '-' between parameters, it's better for seo and user understanding.
If they are parameters, they should be served as parameters. This is better from a user experience point of view, as well as helping search engines to understand your site.
If I go to a page domain.com/shoes/sortBy/date/sortOrder/asc/page/2 then I expect to be able to strip off the end part(s) of the URL to get to a higher-level page. But if I try that here and go to domain.com/shoes/sortBy/date/sortOrder/ that isn't going to work.
With a parameter URL, it doesn't usually matter if you go to ?category=shoes&sortby=date or ?sortby=date&category=shoes, they both give the same page. While the format you've got where you include the parameter name as well as the value in the 'path' URL should enable the same thing to happen, I don't know whether that's guaranteed. Some 'path' type URLs fail when you have the parameters in a different order.
Somehow, somewhere along the line, this myth has arisen that query URLs are always bad, for search engines and for users, and that they should always be re-written as path-based URLs. That just isn't true. Yes, query URLs are a poor choice for a static site, and query URLs that use arbitrary IDs rather than human-readable parameters are often user-unfriendly. But where your site is genuinely dynamic, you're better off using query URLs.
Thanks for the replies so far!
What do you think about the practice of including the id in the URL, along with the user friendly name, e.g. for this thread the url is sitepoint.com/forums/showthread.php?802243-static-urls-vs-dynamic-urls-for-seo-and-ux, with 802243 being the id and static-urls-vs-dynamic-urls-for-seo-and-ux being the user friendly name. I do something similar for my own sites as this provides a relatively user friendly url, but also allows for fast database lookup.
An alternative would be to split the id off into a second parameter, e.g. sitepoint.com/forums/showthread.php?static-urls-vs-dynamic-urls-for-seo-and-ux&threadid=802243. However, I'm not so fond of this method as it makes it look like the thread id is a separate parameter to the thread name, when actually they are both pointing to the same thing.
I'd be interested what you think of this practice.
Another thing that might be worthwhile discussing is how we deal with avoiding duplicate content issues. For single pages where the content on that page will always be there, I think using a canonical tag makes sense. However, for multiple pages where the sortOrder etc. can change the content, I prefer checking the URL looks okay (parameters and values listed are valid), and then issuing a 301 redirect if any of the parameters are incorrect.
I note that sitepoint does not seem to use a canonical tag or a redirect on their multiple pages that can be sorted e.g. http://www.sitepoint.com/forums/forumdisplay.php?3-Search-Engine-Optimization&s=&pp=40&daysprune=-1&sort=lastpost&order=asc&someval=true
I do not currently use canonical or noindex tags on multiple pages where the content can change depending on the sortOrder etc. My method does not avoid duplicate content issues e.g. page 1 sorted in asc order will likely have the same content as the last page when sorted in desc order, but I leave it up to the search engines as to how they want to treat this. I do not use a view-all page either as some of my categories have far too many pages for this to be realistic. However, for smaller sites this could be an option.
Personally, I don't like it. Blog posts, forums threads and news articles is one area where having pages referenced purely by an ID is the most sensible way to go. Given that the ID is an essential part of the URL and points to a unique reference (subject to pagination within the article), there's no need to include anything more. All that happens then is that you get a long and ungainly URL that becomes much more difficult to share and retype, without adding any great value.
If you want to have the name, article title, ... in URL, Including the ID in the URL, along with the name, article, ... helps you in the script code, to get faster and with less instructions the content of that page.
Interesting point, though I would tend to disagree with you. I would guess (I haven't seen any evidence either way) that URLs other than the domain name or a special landing page are very rarely typed. However, I expect that most URLs are shared by copying and pasting. For cases where the sharer does not use any anchor text, a URL with the category name / post title etc. in the URL is easier for others to see exactly what is being linked to.
It is generally established that having relevant anchor text on external links to your pages will help your pages rank better. So I think this helps for SEO purposes as well. e.g.
http://www.sitepoint.com/forums/forumdisplay.php?3-Search-Engine-Optimization - relevant keywords in the anchor text (well, one keyword after vbulletin has shortened the link text), even though I as the user have just copied and pasted the link, without setting any anchor text.
http://www.sitepoint.com/forums/forumdisplay.php?3 - no relevant keywords in the anchor text
I think that probably the search engines would also find a page more relevant if the keywords are included in the page title.
Of course, this is all conjecture on my part, I am not aware of any testing that has been done on these aspects.
This topic is now archived. It is frozen and cannot be changed in any way.