Short URL

irakli - April 24, 2009 - 12:06

#D7CX: I pledge that Short URL will have a full Drupal 7 release on the day that Drupal 7 is released.

An API for creating your own bit.ly, is.gd, tinyurl.com etc. in Drupal, or for just providing cool-looking short "permalinks" to long, parametrized Drupal URLs (e.g. filtered Views).

This module is a developer tool that takes URL of any length and produces very short URLs (3-5 characters). It has no user-interface at this point.

Who Needs This?

You need this module if:

  • You are creating a localized URL shortener for a country/locale that exisitng URL shorteners do not cover.
  • You system is behind a firewall and content/URLs can not be shared publicly.
  • If you want short URLs to carry your own domain, for brand management purposes, much like TechCrunch.com uses http://tcrn.ch domain for short URLs (they do not use this module for the implementation, though, as far as we know :) )

Who uses it?

(Please submit examples of other usages, if you are using shorturl to run your shortener).

Read Joe Trippie's blog post about how it's becoming a trend for large brands to set-up their internal shorteners: http://joetrippi.com/blog/?p=2893. Also the Information Week piece: The Custom URL Shortener

Integration

  • The wonderful Shorten module, which provides an API to shorten URLs via almost any service, now has support for ShortURL as well.

Usage

  • There's one major API function that does the magic. function shorturl_shorten ($long_url). It returns a token that you append to the base URL of your site. E.g. if the base URL is http://example.com and the function returns token "sDf" the access to http://example.com/sDf will redirect to the original long URL with HTTP 302 code.
  • You can also configure from the variables in settings.php following aspects:
    • shorturl_start_from - the starting index. A positive integer. Default is 3844 which corresponds to starting with 3-letter URLs as the minimum (assuming 1 and 2 letter tokens are too short and run out too quickly anyway).
    • shorturl_reserved_tokens - list (array) of words to block in tokens. Tokens containing these words will be blocked. ShortURL module also automatically prevents registering tokens that are a) existing menu handler path b) existing path alias c) contain one of the system reserved words: 'user', 'node', 'term', 'admin.

Credits

Module is sponsored by: Phase2 Technology

Downloads

Recommended releases

Version Downloads Date Links
6.x-1.0-beta1 Download (8.25 KB) 2009-May-13 Notes

Development releases

Version Downloads Date Links
6.x-1.x-dev Download (9.49 KB) 2010-Jan-19 Notes


 
 

Drupal is a registered trademark of Dries Buytaert.