ShURLy is a URL shortening service implemented as a module for Drupal. This module was written by Jeff Robbins for Lullabot’s URL shortener: http://lb.cm and maintained by Jean-Baptiste Lardoux for Nemorius: https://lc.cx

D7 version is ready for use. D8 version is still in development and should not be used in production environment.

It is intended to be fast, clean, simple, self-contained, user-friendly, flexible, and easy to set up.

New URLs are created by going to /shurly and entering the long URL and an optional custom short URL. Short URLs have ownership and each user can track click statistics for his/her URLs.

To maximize the use of characters, URLs are case sensitive. With the correct permissions, short URLs can either be entered custom or autogenerated. Autogenerated URLs use the character set of A-Z, a-z, 0-9. However the characters “01lIO” are not used since these characters are often ambiguous, particularly in print (thanks to Tantek Çelik for this suggestion). Custom URLs may contain any non-reserved characters including UTF8 characters, glyphs, and icons. How fun is that!?

Features

  • Case sensitive custom URLs
  • Unicode (UTF8) URLs
  • URLs can be autogenerated or custom (entered by user)
  • Extensive role-based permissions
  • Click-to-copy-to-clipboard functionality on short URLs
  • Click tracking on each short URL
  • Ability to change the destination
  • Short URLs are associated with user accounts. Logged-in users can see their URLs history as well as the number of clicks on each.
  • “Drag to bookmark bar” Javascript bookmarklet to create URLs quickly from any web page
  • Blocks for URL creation form, bookmarklet, and URL history
  • Views integration. Short URLs are displayable objects
  • Magic happens during hook_boot() for fast, efficient, and early redirection. Doesn’t require a full Drupal bootstrap to redirect. Also redirection works even if page caching is turned on. If unsupported short-url characters (such as “/”) are part of the incoming URL, ShURLy doesn’t even add a database query.
  • Web services API to shorten/expand URLs
  • Supports configurable per-role rate limiting. Roles can be limited to {X} requests every {Y} minutes to prevent automated misuse of the website or API.
  • Per-user API key generation to allow user-associated web services interaction
  • hook_shurly_redirect_before() and hook_shurly_redirect_after() allows other modules to tap in and alter the redirection, or log additional info to the database (IP tracking, anyone?)
  • Check submitted URLs with Google Safe Browsing API
  • Google Analytics Integration.

USAGE

  1. Place the module in your modules directory and enable.
  2. Visit admin/user/permissions to set up permissions for Shurly (see explanation of permissions below).
  3. To create a new short URL, visit /shurly or add the “Create a short URL” block to your site.
  4. To view your own URLs, visit /myurls or add the ‘My URLs’ block
  5. Administrators can view all users’ URLs at admin/build/shurly
  6. To configure rate limiting, visit admin/build/shurly/settings

Since short URLs are created at the root path of the site (http://example.com/myURL), it is recommended that this module be used as the basis for a complete site, not as an add-on to an existing site. That being said, the module does its best to ensure that entered URLs don’t conflict with existing menu entries and path aliases in the current Drupal installation. ShURLy should work even if Drupal is installed in a subdirectory or without clean URLs.

Views

ShURLy is completely integrated with the Views module and ShURLy links can be listed/sorted/displayed using Views. Views is a dependency of this module since all listings are created using Views, including the administrative page at admin/build/shurly. Views also provides a page at /myurls where users with “View own URL stats” can see & sort their URLs.

Views integration also means that you could create new pages/blocks with listings like “most popular URLs”, “users with most popular URLs”, “most recent URLs”, “most recently clicked URLs”, or a tab on a user’s page to show others their most recent URLs, and that sort of thing.

Blocks

  • Create a short URL:
    the form to create a URL
  • ShURLy bookmarklet:
    A block containing a “drag to your bookmarks bar” link. Clicking this
    bookmarklet when on a page bring the user to the the URL shortening
    site with the URL field filled in for that page.
  • My URLs:
    This block is created by Views and is basically just a mirror the
    /myurls page. However, by putting this content into a block, you can
    put it into the ‘content bottom’ region on the /shurly page and get
    a single page with both the entry form and the URL listing

Permissions

  • Create short URLs:
    Allow users in this role to create URLs. This permission also allows users to delete URLs which they have created.
  • Enter custom URLs:
    Allow users in this role to enter their own short URLs,
    without this permission all URLs will be autogenerated
  • View own URL stats:
    Allow users to view the “My URLs” page (at /myurls)
  • Edit short URLs (D7/D8 only):
    Allow users to change the destination of the short URLs.
  • Delete own URLs:
    Users may ‘delete’ URLs which they have created. For security reasons,
    these URLs are actually only deactivated. They still exist in the
    database and new URLs are not allowed to be created with the same
    short URL path.
  • Administer short URLs:
    This permission allows users to edit/delete/view all short URLs by
    all users. This is the administrative permission and should be
    used carefully

Demo: http://lb.cm (discontinued) or https://lc.cx
Inspiration: https://www.youtube.com/watch?v=Qo7qoonzTCE
Lullabot: http://www.lullabot.com

In memory of Leslie Nielsen.

I am serious, and don’t call me Shurly!

Supporting organizations: 
Author and maintainer

Project information

Releases