36

I think it might be a good idea to have a URL-shortening service for each of the Stack Overflow family of sites.

Since questions, and answers all have a unique id, it should be fairly easy to use that for shortening the URLs.


For example: (Could easily be shorter)

http://short-SO-url.com/1234

This could easily point to a question, or an answer. All this would need to do is redirect to:

http://stackoverflow.com/questions/1234

Or if it is an answer, point to:

http://stackoverflow.com/questions/{question-id}/-/1234#1234

You need something between the question id, and the answer id. That is why there is /-/ in the URL.


Right now, if you want a shorter URL, you have to use a third-party URL shortener which can point to anywhere. It is also difficult, or impossible to know that it doesn't redirect to a malicious website. If there were an official URL shortener that only worked for Stack Overflow, you would know for sure that it is safe.


This would be easier if there was an internal interface to redirect to the correct URL.

http://stackoverflow.com/api/post/1234.301

It could redirect to the correct URL regardless of if it is an answer or a question. 301 redirect

18
  • 37
    Don't post your own ideas for the domain name here, someone could register it before the Stack Overflow team could register it. If you really feel strongly about a domain name, send them an email instead. Sep 29, 2009 at 14:48
  • 1
    I think the idea of soshort.net/question# might be rather handy. Too bad soshort.com is already taken.
    – Dillie-O
    Sep 29, 2009 at 15:08
  • What about surly.net, but who thought that was a good name for a dating site?
    – Alex Angas
    Sep 29, 2009 at 15:19
  • 2
    Please read Brad's comment guys... <rolleyes />
    – Daniel May
    Sep 29, 2009 at 15:24
  • See: meta.stackexchange.com/questions/21361/…
    – Shog9
    Sep 29, 2009 at 17:34
  • 2
    (IMHO, if SO URLs are too long for you to handle, you have bigger problems)
    – Shog9
    Sep 29, 2009 at 17:36
  • I was thinking of something so short that the post id would be the longest part. Sep 29, 2009 at 18:14
  • 3
    @Brad: but what good does the post ID do without the title, domain, and path? You're stuck with the same brain-damage that every other URL-shortening service gives you: a link that could point to anything!
    – Shog9
    Sep 29, 2009 at 19:13
  • 3
    It could point to any question or answer, but you at least know that it redirects to Stack Overflow. Sep 29, 2009 at 19:20
  • Once you know the domain belongs to SO, sure. But "a programming Q&A site" wouldn't otherwise be my first guess upon encountering, say, so.fu/o23834...
    – Shog9
    Sep 29, 2009 at 19:25
  • 5
    There's no point in doing this. They're short enough. Come on people, it's a few letters, they won't kill you if you type them :)
    – alex
    Sep 29, 2009 at 19:55
  • This question was actually in response to an email I sent, suggesting a possible domain that I thought would be great for this. Sep 30, 2009 at 19:04
  • I would love this functionality! Makes it easier to share on Twitter. Jan 17, 2011 at 20:40
  • IMHO this is not worthwhile. The only advantage over existing URL-shortening services is that we could guarantee that only redirects to SO/SE pages would be allowed. But I think it's better in the long run not to encourage a proliferation of highly-specific URL-shortening websites. Jan 18, 2011 at 17:52
  • @KeesC.Bakker Twitter auto shortens all links to a standard 23 characters. support.twitter.com/articles/78124 May 28, 2016 at 7:46

6 Answers 6

27

The following is officially supported and redirects to the full URL (using a 302 Found):

meta.stackoverflow.com/q/23834

Also, despite the /q for /question: if this happens to be an answer ID, it redirects properly too. But I am not sure if that is official too? Like:

meta.stackoverflow.com/q/75352

...redirects to

meta.stackoverflow.com/questions/23834/official-shortened-url-service/75352#75352

Note that, before redirecting, the latter gets one a 404 if the answer is deleted, even when the question still exists. The long URL would then take one to the question instead.

As an aside: exotic domain names, like Libya's .ly as used by bit.ly, might not be very future proof.

Users who can see deleted posts, won't get the 404. I guess that's the reason for the 302 Found (along with Cache-Control: private) rather than 301 Moved Permanently.

1
12

URLs on stack overflow are already pretty short, especially once you remove the post title and such. In your example, you aren't really saving that much. I think if you wanted something considerably shorter, you'd have to go to something like tinyurl has, and you'd end up with something like

http://stackoverflow.com/url/D839d8D

Which still wouldn't gain you much over the already pretty short url of

http://stackoverflow.com/questions/1234256

With answers, it gets a bit longer but I think that we could come up with a link to an answer like

http://stackoverflow.com/answers/1234256

and then a database lookup could be done to direct you to the correct question. Same thing could be done for comments.

Doing something like this for direct links to answers and comments would be much easier to costruct your own URL, and would keep much more to the MVC spirit of things.

4
  • 1
    I was actually thinking it could be much shorter than the example in the question. I was thinking that it could be so short that the Post id could be the longest part of the url. Sep 29, 2009 at 14:57
  • 4
    You can link to an answer like you would to a question; it will automatically be redirected: meta.stackexchange.com/questions/23836
    – balpha StaffMod
    Sep 29, 2009 at 15:08
  • 4
    Great, so even for answers, we have pretty short URLs. shortened URLs are great for things like mapping sites where the url is 500 characters long. I don't think that stackoverflow really has a need for an official url shortener, as the urls are already pretty short.
    – Kibbee
    Sep 29, 2009 at 15:17
  • Also, questions and answers can be abbreviated q and a: meta.stackexchange.com/q/23834
    – Zaz
    Mar 31, 2013 at 12:00
10

http://www.codinghorror.com/blog/archives/001276.html

0
5

What would be the benefit? Only thing I can think off the top of my head is less text to send back to the client, which I'm not sure outweighs the cost of maintaining the additional system.

5
  • 8
    I was thinking someone could use it for Twitter. Sep 29, 2009 at 14:53
  • 3
    Not only twitter, but any reference. Small urls are much more attractive than larger ones. They also look better when used inline in paragraphs, especially paragraphs that aren't really wide.
    – Sampson
    Sep 29, 2009 at 15:21
  • 5
    Small URLs are actually only better if the longer one is completely unreadable anyway. With MVC style URLs, where they are actually readable, and quite short already, you lose a lot when you move to a shortened url. I think it's much more "attactive" to have a reasonably sized URL that tells me exactly where it's going to go over a short url that tells me nothing. The short URL that tells me nothing is only more "attactive" when compared to extremely long URLs that tell me nothing.
    – Kibbee
    Sep 29, 2009 at 15:38
  • 1
    What Kibbee said. The best part of SO URLs is the title at the end... Whoever thought hyperlinked tinyURLs were a good idea should be banned from ever using HTML again.
    – Shog9
    Sep 29, 2009 at 17:39
  • You could probably do the same thing that happens now, You can add anything after the post id. Sep 29, 2009 at 19:22
2

I think this is a good idea now that we have a "share on Twitter" button. I just used this for the first time and Twitter shortened the URL. If it's going to get shortened anyway, we should have our own shortener. As site owners, it would allow you to better keep track of what people are actually clicking on. Here's a screenshot:

alt text

1
  • Wow, Twitter needed to go all the way to Colombia to get the shortest possible domain? (Not really the shortest; http://.to/ beats that.)
    – Arjan
    Jan 18, 2011 at 18:05
2

We do have a URL shortener for sites, but it doesn't navigate to individual pages. Just sites.

What shortened URLs are available through s.tk?

3
  • Do you know why it won't navigate to individual pages?
    – ChrisW
    Nov 17, 2012 at 11:31
  • @ChrisW: Don't know -- you can put up a feature request here on meta if it's not already out there... Nov 17, 2012 at 11:44
  • I found an answer at meta.stackexchange.com/a/110462/139866
    – ChrisW
    Nov 17, 2012 at 11:52

Not the answer you're looking for? Browse other questions tagged .