Saturday, June 23, 2012

Branded Short URLs

Short links are great, but wouldn’t it be great to have your own such service, much like New York Times (nyti.ms). It turns out that there are at least three ways you can achieve this goal. We will be looking at Bitly Pro, Google Links and hosting your own.

The easiest setup is, undoubtedly, Bitly Pro. If you already have a domain name all you need to do is create an A record for it and point it to Bitly.com server (currently 69.58.188.49). Just follow their instructions in the advanced settings. Currently, you can do so with only one such domain per account. You have the option to use forwarding on your naked domain (as we’ve done with d0t.ro), or set up a subdomain with either an A record or CNAME. Once set up in this manner, you can use it with older bitly shortcuts, such as bit.ly, j.mp. Bitly also provides a number of stats and it is quite possibly the most popular such service, which suggests that it will survive.

ggl

Google Short LinksAnother service that is likely to survive is Google Short Links, currently a “Labs” feature. If you are using Google Apps with your own domain, you just got to the Google Market using the link below and add it there.

Unlike Bitly, this service will not allow you to use your naked domain, nor will you be able to use an A record – at least not in its current incarnation. You will have to use a subdomain (we used go) set up a with CNAME record pointing to – you guessed it! – ghs.google.com:

Short Links Settings topOnce your changes have propagated, you can adjust a number of settings, including whether the “jump” is done via 302 or 301 redirect (temporary vs permanent), as follows:

20120623-002-screencapAs you might know, 302 allows the link juice, PageRank etc to be retained by your domain.

yourls

To use this free suite of PHP scripts, you need, apart from your own domain name, a server with mod_rewrite (most webhosts have that), PHP 4.3+ and mySQL 4.1+ – again, most hosting services easily meet and surpass these requirements.

You change settings via config.php.
  • YOURLS_SITE
    Your (short) domain URL, no trailing slash
    Example: 'http://ozh.in'
  • YOURLS_HOURS_OFFSET
    Timezone GMT offset
    Example: '-5'
  • YOURLS_PRIVATE
    Private means protected with login/pass as defined below. Set to false for public usage (on an intranet for instance)
    Example: 'true'
  • YOURLS_UNIQUE_URLS
    Allow multiple short URLs for a same long URL
    Set to true to allow only one pair of shortURL/longURL (default YOURLS behavior), or to false to allow creation of multiple short URLs pointing to the same long URL (as bit.ly does)
    Example: 'true'
  • YOURLS_COOKIEKEY
    A random secret hash used to encrypt cookies. You don't have to remember it, make it long and complicated. Hint: generate a unique one at http://yourls.org/cookie
    Example: 'qQ4KhL_pu|s@Zm7n#%:b^{A[vhm'
  • yourls_user_passwords
    A list of username(s) and password(s) allowed to access the site if private
    Example: 'joe' => 'mypassword'
URL Shortening settings
  • YOURLS_URL_CONVERT
    URL shortening method: base 36 or 62. See FAQ for more explanations
  • yourls_reserved_URL
    A list of reserved keywords that won't be used as short URLs. Define here negative, unwanted or potentially misleading keywords
    Example: 'porn', 'faggot', 'sex', 'nigger', 'fuck', 'cunt', 'dick', 'gay'
Optional settings
  • YOURLS_PRIVATE_INFOS
    If YOURLS_PRIVATE is set to true, you can still easily make your individual stat pages public. To do so, override the global private setting with:
    define('YOURLS_PRIVATE_INFOS', false);
  • YOURLS_PRIVATE_API
    If YOURLS_PRIVATE is set to true, you can still easily make your API public. To do so, override the global private setting with:
    define('YOURLS_PRIVATE_API', false);
  • YOURLS_NOSTATS
    If YOURLS_NOSTATS is set to true, redirects won't be logged and there will be not stats available.

YoURLs uses plugins and integrates tightly with Wordpress, should you choose to use it that way. Best of all, it’s free!

others

We do not recommend such services other than what we listed above, as it is quite easy to set up your own and if not, you can use Bitly or the free Goo.gl. Others may offer value-added services: TinyArrows, budurl, XR. Whatever you choose, be happy!

Sources / More info: Google Short Links, bitly, yourls, domai.nr

No comments:

Post a Comment

Thank you for commenting and rest assured that any and all comments are welcome, whether positive or negative, constructive or distructive. Unfortunately, if you comment in this view I might not know about - please use the regular (Desktop) view.
I am using Disqus for commenting, but Blogger is not showing it so your comments may end up not being displayed - tell Google about it!