The URL for this question is currently
https://meta.stackexchange.com/questions/110407/please-add-question-and-answer-shortlinks-with-site-names-to-the-s-tk-url-shorte
which is very long. This is partially mitigated by the https://meta.stackexchange.com/q/110407
syntax, but still quite large, especially for places like http://meta.electronics.stackexchange.com/q/123456
. The links to any answers will be even longer, having something like /110408#110408
appended to the URL, even if it's shortened.
Now that we have an awesome URL shortener, this can be shorter! We could reduce the short link to http://s.tk/meta/q/110407
without losing any information contained in the current shortened question URL.
Before you freak out about the nastiness of having thousands of short URLs, the opacity and durability problems of big hashmaps like the ones behind normal URL shortening services, the complexity a big network of referral IDs that can never be lost or changed, or whatever might worry you about this proposal, consider this option:
You don't have to set up a whole network of referral IDs which can be lost. You don't need a big hash map pointing to arbitrary places. Just forward the text following http://s.tk/<short site>
to the destination. I'm no ASP.net wizard (in fact I've never written a line of C# in my life until this very moment), but I'm guessing (based on a Stack Overflow search) that something like the following currently resides at http://s.tk/so:
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.stackoverflow.com");
}
Just add two commented lines, and edit the last one:
private void Page_Load(object sender, System.EventArgs e)
{
// Get the current URL
string url = HttpContext.Current.Request.Url.AbsoluteUri;
// ex. 'http://s.tk/so' or 'http://s.tk/so/q/123456'
// Change it to the new one
url = "http://www.stackoverflow.com" + url.Substring(14);
// Beware the magic number! It's strlen("http://s.tk/so")
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location", url);
}
I've proposed this with the Google Docs tool (http://s.tk/linkrequest) as requested in How do we get a new s.tk added?, but that's been silent, so I'll write it here, in public:
Please send the information after the s.tk short link to the destination page.
/linkrequest
ed this earlier myself. If/so
goes tohttp://stackoverflow.com/
, I would hope that/so/FOO
would go tohttp://stackoverflow.com/FOO
. It seems like the natural thing to do.http://meta.stackexchange.com/q/110407
is a valid URL to this question.http://meta.stackexchange.com/q/110407
syntax. That's a valid URL, but it's not a short URL in my book.http://s.tk/meta/
is a short URL that redirects tohttp://meta.stackoverflow.com
; I am proposing that we be allowed to tack/q/110407
onto the actual short form.