An API module that allows the creation of branded short URLs.

This module is a developer tool that takes URL of any length and produces very short URLs (3-5 characters).

For the User-Interface integration you may want to check-out: Shorten module.

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).

Credits

Created and maintained by: Phase2 Technology
Development on this module was done as part of the Whitehouse.gov project and was sponsored by The Executive Office of the President.

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, $full_url = FALSE).

    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.

Project Information

Downloads