Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Which of the following URLS are clearer?

    1a. https://foo.com/
    1b. https://www.foo.com/

    2a. https://foo.com/search/products/couches/color/red
    2b. https://foo.com/search?products=couches&color=red

    3a. /posts?recent
    3b. /posts?recent=
    3c. /posts?recent=true

    4a. /post/1234/products-couches-furniture-red-cheap-recent-ikea-tags
    4b. /post/1234/
I can think of good reasons for picking each of these, and even good reasons for picking their alternatives. URL design is tricky to get right because realistically you can't change it later.


> 1a. https://foo.com/ > 1b. https://www.foo.com/

www for old folks, non www for all the rest.

> 2a. https://foo.com/search/products/couches/color/red > 2b. https://foo.com/search?products=couches&color=red

https://foo.com/search?products=couches&color=red

Those are parameters, not a path. The first one has only value as an SEO optimization.

> 3a. /posts?recent > 3b. /posts?recent= > 3c. /posts?recent=true

/posts/recent

> 4a. /post/1234/products-couches-furniture-red-cheap-recent-ikea-tags > 4b. /post/1234/

Both should work on your website, 4b should redirect on 4a.


I disagree with 1 as a blanket statement.

There are technical reasons to consider, as well (yes, it's DNS again). If you want to receive emails @foo.com, you have to set MX records for foo.com., and that means you can't set a CNAME anymore - you'll have to make do with A/AAAA records.

For a lot of applications this is not an issue, but it does mean an overhead for highly distributed services. You won't see many global/high traffic companies drop the benefits 'www' gives. This is not purely to get the 'old folks' market.

(PS: The subdomain doesn't have to be www., of course - cnn goes with edition.cnn.com., for example.)


Yep. The DNS hierarchy exists for a reason, and if you have a bunch of machines, you want to use it.

Also, I'm a single person, and I have multiple independent web sites. Many of them live under the same domain. Lots of companies have many more. You can play annoying tricks to smush them all into a single name (at least, most of the time), but why?

I think the world is ready to internalize the idea of hierarchic names, at least insofar as understanding they're independent entities grouped under the same name. Haven't seen any studies, but it seems like we're past the 'do I need the "www"'? point.

All that said, I also like short. The magic comes from knowing when to choose what, and I don't think you get there with rules-of-thumb alone.


I disagree with 2a. No reason why this shouldn't be a path that the user can edit to go one level "up" to /search/product/couches.

That's kind of the point of the article - these are parameters for the programmer, but are UI to the user.

Separating parameters by "&", except for the first KVP which is separated by "?" from the URL is not intuitive. On the other hands, they path editing is familiar.


Unless you have only one product that has color, or that color is the only thing you can filter your couches by, then no, it's not a hierarchy. There no nothing of "going up".


> No reason why this shouldn't be a path that the user can edit to go one level "up"

While I find it more visually pleasing, this is my issue with this style: traversing up would first include /search/product/couches/color, which doesn't make sense. I've seen alternatives like /color:red/ before - which takes away the pairing-problem but feels odd..


And imply you only have product and color. What about size, price, date, description, rating, etc. It is a "search" url after all.


Products aren't hierarchially ordered first by type, then by colour, then by material, etc. These are all attributes that have multiple possible orderings (or no order at all).

Of course, if the site is designed such that it forces you to pick those attributes in a specific order, that URL scheme would make sense (but that would be a poor design for other reasons).


I'd be happy with any of these. What I'm meeting with my team next week to discuss is establishing some conventions to avoid stuff like this:

4c. /post/_level/modular/1234--Products--Couches%20red+cheap%20ikeaTags%28OLD%29.aspx


I think this is more user friendly.

    https://foo.com/search?products=couches;color=red;show_recent;


Wow it does feel so much more readable than using an ampersand. I'd still prefer an ampersand because it plays well everywhere and the kind of people who'd look at url and try to understand would be too ingrained to ampersand anyway.


Of course you can change it later, that's what 301s are for.


If you make money with it, 301s are going to hurt the wallet for some months.


You obviously have no idea what you're talking about.


I had several websites where changing the URL schemas resulted in Google rank dropping, resulting in advertising revenue loss. I don't see I can be more honest than that. And frankly, you are not just unfair, you are being rude.


You changed them without redirecting properly.

Actually, tell me a few of these websites.


Those are porn websites, so I'm not going to share them. And there are only 2 kinds of redirection, permanent or temporary so it's pretty hard to do it incorrectly.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: