YOURLS: Your Own URLShortener

About YOURLS

What is YOURLS

YOURLS is a small set of PHP scripts that will allow you to run your own URL shortening service (a la TinyURL). You can make it private or public, you can pick custom keyword URLs, it comes with its own API. You will love it.

There's a WordPress plugin available for YOURLS, making integration with your blog a snap: create short URLs and tweet them automagically as you publish blog posts.

YOURLS Features

Private (your links only) or Public (everybody can create short links, fine for an intranet)

Site options

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/cookieExample:'qQ4KhL_pu|s@Zm7n#%:b^{A[vhm'

yourls_user_passwords
A list of username(s) and password(s) allowed to access the site if privateExample:'joe' => 'mypassword'

URL Shortening settings

YOURLS_URL_CONVERT
URL shortening method: base 36 or 62. See FAQ for more explanations

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.

Advanced settings

File includes/yourls-load.php contains a few more undocumented but self explanatory and commented settings. Add them to your own config.php if you know what you're doing

WordPress Plugin

Features

Generate short URLs for each new post or page

Generate short URLs for all your old posts and pages if wished

Send a tweet on your Twitter account with the post title and short URL as you publish them

Works if YOURLS is hosted on the same server or on a remote server

Also compatible with tr.im, is.gd, tinyurl.com and bit.ly for maximum fun

Screenshot

Download & more informations

Plugins for YOURLS

Plugins?

Plugins are additional PHP scripts that extend the functionalities or features of YOURLS. The core of YOURLS is designed to be as light as possible and avoid bloat (implementing functions not everybody needs) and to allow for easy customization.

Using the plugin architecture, you can add new features to YOURLS without having to modify core files. This way, your changes won't be lost when you upgrade your YOURLS installation.

Documentation

Several sample plugins are included in the archive. Read the source and learn the concept. It's easy and fun!