Why should I use "Web 2.0"-style URLs? [closed]
Asked Answered
T

8

8

In short, why use something like http://stackoverflow.com/badges/6/supporter instead of something "simpler" (and subjectively, at that) like http://stackoverflow.com/badges/6/.

Even on my own site I've just been using /post/6/ to reference posts (by IDs, even though I still store a slug.) Instead of /post/6/small-rant-on-urls, and in some cases, they can get even more absurd, much more so than is really necessary.

Thorazine answered 24/1, 2009 at 7:45 Comment(0)
H
5

Because you can potentially end up with duplicates if you're not careful. I imagine stack overflow added the ID because there was a high potential for duplicates given the volume of posts created.

Other systems may choose not to use the ID in the URL - for example, a blogging system probably would not need to.

It's a better idea if you have user generated content that results in a new URL created to include a post ID. If the only way new URL's can be created is through administrator type access, you can probably do without it as long as you check for duplicates.

Hoop answered 24/1, 2009 at 8:8 Comment(0)
O
21

Search Engine Optimisation would be one, as well as making the URL more readable to humans. Search engines generally like your URL, Title and H2 to contain the "topic" of the page.

If you have both in there then you can manually type /ID and get automagically taken to the "flowery" URL with rewriting.. saves your fingers a bit :)

Orethaorferd answered 24/1, 2009 at 7:48 Comment(3)
I thought about doing something like that but haven't decided to how to go about implementing it. Though the only problem would be trying to give "fancy" URLs out to search spiders and keep URLs the same for normal visitors.Thorazine
I don't think you need to give out "normal" URLs to visitors, as most people won't manually type URLs in, but being able to just put /Id is useful for yourself and any geeky power users that like to type :)Orethaorferd
As ever.. I wish people would comment when they neg.Orethaorferd
H
5

Because you can potentially end up with duplicates if you're not careful. I imagine stack overflow added the ID because there was a high potential for duplicates given the volume of posts created.

Other systems may choose not to use the ID in the URL - for example, a blogging system probably would not need to.

It's a better idea if you have user generated content that results in a new URL created to include a post ID. If the only way new URL's can be created is through administrator type access, you can probably do without it as long as you check for duplicates.

Hoop answered 24/1, 2009 at 8:8 Comment(0)
H
4

Adding the slug in all links to the content helps with search engines, because search engines will generally use words in the URL itself to help index content.

Heterophyte answered 24/1, 2009 at 7:48 Comment(0)
P
3

The reason for including the id in the url is that it makes it easier behind the scenes to retrieve the correct article from the database, as a lookup can be performed on the ID rather than the article's title.

The reason for including the full title of the article, is that Google gives heaps of bonus points for search terms that are matched in the filename.

Pinta answered 24/1, 2009 at 8:7 Comment(0)
C
3

URL is part of the Web user interface.

There is an eyetracking study of search engine use that found that people spend 24% of their gaze time looking at the URLs in the search results.

Searchers are particularly interested in the URL when they are assessing credibility and usefulness of a destination. If the URL looks like garbage, people are less likely to click on that search hit. On the other hand, if the URL looks like the page will address the user's question, they are more likely to click.

Christmann answered 24/1, 2009 at 14:48 Comment(0)
T
2

@Greg Hewgill

Adding the slug in all links to the content helps with search engines, because search engines will generally use words in the URL itself to help index content.

I should have clarified a bit: I meant URLs that have both an id and slug in them. I just don't see the point in having something like /post/1/la-la-la-la-text-hahahaha vs /post/1/ or /post/la-la-la-la-text-hahahaha, since the first one would work without the extranous text at the end.

Thorazine answered 24/1, 2009 at 7:58 Comment(1)
Oh I see what you mean. I find it convenient to be able to use (on SO) just the post ID to enter into the URL. Also, if the server ignores the slug then you can change the title of the question and inbound links will still work.Heterophyte
G
0

It could be that is faster to get the post in a blog by the id than by the slug, so put the id for the SQL query and the slug for the search engines (SEO).

https://stackoverflow.com/users/58163/movaxes65675

I like the /post/la-la-la-la-text-hahahaha type, i can remember the url, know what the title of the post is (before actually loading the site). Don't like much the /post/1/ it means nothing to me but post #1 (bad for marketing?)

edit: id also helps to avoid duplicates as andybaird pointed

Gaultheria answered 24/1, 2009 at 8:10 Comment(0)
E
0

Well, firstly it should be pointed out that the "Web 2.0 style URLs" are actually part of something called REST. Those URLs are sometimes called RESTful URLs. The claimed benefits are:

  • Provides improved response time and reduced server load due to its support for the caching of representations;
  • Improves server scalability by reducing the need to maintain session state. This means that different servers can be used to handle different requests in a session;
  • Requires less client-side software to be written than other approaches, because a single browser can access any application and any resource;
  • Depends less on vendor software and mechanisms which layer additional messaging frameworks on top of HTTP;
  • Provides equivalent functionality when compared to alternative approaches to communication;
  • Does not require a separate resource discovery mechanism, due to the use of hyperlinks in representations;
  • Provides better long-term compatibility and evolvability characteristics than RPC. This is due to:
    • The capability of document types such as HTML to evolve without breaking backwards- or forwards-compatibility; and
    • The ability of resources to add support for new content types as they are defined without dropping or reducing support for older content types.
Enmesh answered 25/1, 2009 at 0:30 Comment(1)
Those are benefits of REST as a whole, not the URLs that come along with it.Propjet

© 2022 - 2024 — McMap. All rights reserved.