Having been caught up in the wheels of the bandwagon, I’ve been playing with short link generators that you self–host.
Disconnected thoughts:
been playing with short url technologies, WordPress and the inevitable short domain names, IDNs that look cool / shorter.
Choices influenced by Zeldman’s “Shorten this” [http://zeldman.com/x/50] and the comments attached to it.
WordPress plug-ins for shorter links – short link, short url, la petite url [ or le petite url <sic>, «le petit url» might be correct, mais my GCSE French didn’t cover the web ].
causerelatedmarketing.co.uk – a mouthful (especially with yyyy/mm/slug on the end); crm♻.ws is much more manageable for 140 character stuff
♻ influenced by @daringfireball / John Gruber’s ✪df.ws – even went to the same registrar!
Initially set up shorturl (used exactly as Zeldman does, except under the default letter); with a single tweet to test.
l p u [1.06] : allows http:// in prefix, then prints that after blog’s domain leading to http://example.comhttp://short-domain.tld/ as prefix to short links – need to make $blogurl = ”; rather than get_bloginfo(‘siteurl’);
produces short links of definable length out of any of a-z, A-Z and 0-9 or a combination; these are generated at the point of a post’s publication, or alteration in the case that l p u [1.06] has been added to an existing self–hosted WordPress blog [ wordpress.com blogs get an auto-generated wp.me short link ]
short link works in a different way, making use of a post’s numeric ID as its short URL – this doesn’t require an existing post to be altered to be available
crm♻.ws is just an alias (ServerAlias, mod_vhost_alias) of causerelatedmarketing.co.uk
/domains/c/a/causerelatedmarketing.co.uk and
/domains/x/n/xn--crm-k05a.ws are both symbolic links to the same place in the filesystem, xn--crm-k05a.ws being the punycode representation
none really handle having a different domain for your short URLs very neatly without some hacking
WordPress plugins
ShortURL … return $shortlink; instead of return get_bloginfo(‘url’) . “/” . $shortlink;
.htaccess tweaked :
RewriteCond %{HTTP_HOST} ^xn--crm-k05a\.ws$
RewriteRule ^u/([0-9]+)$ u.php?$1|$2
(adding RewriteCond)
PHP-centric tech., since I don’t grok perl, python, ruby
SQL ess cue ell [ sequel? ] – was listening to Sitepoint podcast …
Lots of .htaccess mod_rewrite hackery needed when a site reports itself as domain0.tld0 when visited at domain1.tld1; the judicious use of RewriteCond %{HTTP_HOST} certainly helps, especially when one filesystem is seen as different sites, subdirectories of the root; shopping.chrs.nl being a sibling of who-is.chrs.nl, itself an alias of domain0.tld0.
Twitter Blog plug-in hacked about so that la-petite-url links used instead of bit.ly – and since I didn’t have a recent enough php, json_decode() is missing… and the replacement function has output in the form of an array, not an object.