<p><strong>YOURLS</strong> stands for <strong>Your Own URL Shortener</strong>. It is a small set of PHP scripts that will allow you to run your own URL shortening service (<em>a la</em> TinyURL or bitly).</p>
<p>Running your own URL shortener is fun, geeky and useful: you own your data and don't depend on third party services. It's also a great way to add branding to your short URLs, instead of using the same public URL shortener everyone uses.</p>
<h3id="features">YOURLS Features</h3>
<ul>
<li><tt>Free</tt> and <tt>Open Source</tt> software.</li>
<li><tt>Private</tt> (your links only) or <tt>Public</tt> (everybody can create short links, fine for an intranet)</li>
<li>Sequential or custom URL keyword</li>
<li>Handy <tt>bookmarklets</tt> to easily shorten and share links</li>
<p>See a live example of YOURLS stats on <ahref="http://yourls.org/cookie+">http://yourls.org/cookie+</a></p>
</div>
<h2id="download">Download</h2>
<p><ahref="http://yourls.org/download">Download YOURLS</a> from Github</p>
<p>You can follow YOURLS' development on the <ahref="http://yourls.org/revisions">commit history</a> and get <ahref="https://github.com/YOURLS/YOURLS/archive/master.zip">current development build</a></p>
<h2id="credits">Credits</h2>
<p>YOURLS is made by <ahref="https://github.com/YOURLS/YOURLS/graphs/contributors">awesome people</a>.</p>
<p>Keep up to date: follow <ahref="http://twitter.com/yourls">@yourls</a>, <ahref="http://twitter.com/ozh">@ozh</a> (lead developper)and read the official <ahref="http://blog.yourls.org/">YOURLS Blog</a></p>
</div>
<!-- Installation Instructions -->
<divid="InstallDiv"style="display: none;">
<h2class='first'id="fresh">Fresh Install</h2>
<ol>
<li>Unzip the YOURLS archive</li>
<li>Copy <code>user/config-sample.php</code> to <code>user/config.php</code></li>
<li>Open <code>user/config.php</code> with a raw text editor (like Notepad) and fill in the required settings</li>
<li>Upload the unzipped files to your domain <code>public_html</code> or <code>www</code> folder</li>
<li>Create a new database (see <ahref="#Config"onclick="toggle(this);">Configuration</a>– you can also use an existing one)</li>
<li>Point your browser to <code>http://your-own-domain-here.com/admin/</code></li>
</ol>
<h2id="upgrade">Upgrade</h2>
<ol>
<li><strong>Backup the database!</strong></li>
<li>Unzip the YOURLS archive</li>
<li>Upload files to your server, overwriting your existing install</li>
<li>Point your browser to <code>http://your-own-domain-here.com/admin/</code></li>
<li>Tip: you can now move your <code>config.php</code> file to the <code>/user</code> directory</li>
</ol>
<h2id="upgrade13">Upgrade from YOURLS 1.3 or earlier</h2>
<ol>
<li><strong>Backup the database!</strong></li>
<li>Make a copy of your <code>config.php</code></li>
<li>Delete all files including <code>.htaccess</code> in YOURLS root directory</li>
<li>Unzip the YOURLS archive, upload the files</li>
<li>Copy <code>config-sample.php</code> to <code>config.php</code> and fill in details. <strong>Don't start with your old config file</strong>, use the new sample config file.</li>
<li>In your new <code>config.php</code>, add the <em>defines</em> for <code>YOURLS_DB_TABLE_URL</code> and <code>YOURLS_DB_TABLE_NEXTDEC</code> you had in your previous config file
<li>Point your browser to <code>http://your-own-domain-here.com/admin/</code> and follow instructions</li>
<li>After upgrade is well and over, remove the define <code>YOURLS_DB_TABLE_NEXTDEC</code> from your config file</li>
</ol>
</div>
<!-- Configuration Instructions -->
<divid="ConfigDiv"style="display: none;">
<h2class='first'>Configuration (in <code>user/config.php</code>)</h2>
Your (hopefully short) domain URL, no trailing slash, lowercase. If you pick the non-www version of your domain, don't use the www version in your browser (and vice-versa)<br/>
Private means the admin area will be protected with login/pass as defined below. See <ahref="http://yourls.org/privatepublic">Private or Public</a> for more.<br/>
Allow multiple short URLs for a same long URL<br/>
Set to <tt>true</tt> to allow only one pair of shortURL/longURL (default YOURLS behavior), or to <tt>false</tt> to allow creation of multiple short URLs pointing to the same long URL (as bit.ly does)<br/>
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 <ahref="http://yourls.org/cookie">http://yourls.org/cookie</a><br/>
A list of username(s) and password(s) allowed to access the site if private<br/>
Passwords can either be in plain text, or encrypted: see <ahref="http://yourls.org/userpassword">http://yourls.org/userpassword</a> for more information.<br/>
If <code>YOURLS_PRIVATE</code> is set to <tt>true</tt>, you can still make stat pages public. To do so, define with:<br/>
<tt>define('YOURLS_PRIVATE_INFOS', false);</tt>
</li>
<li><code>YOURLS_PRIVATE_API</code><br/>
If <code>YOURLS_PRIVATE</code> is set to <tt>true</tt>, you can still make your API public. To do so, define with:<br/>
<tt>define('YOURLS_PRIVATE_API', false);</tt>
<li><code>YOURLS_NOSTATS</code><br/>
If <code>YOURLS_NOSTATS</code> is set to <tt>true</tt>, redirects won't be logged and there will be not stats available.<br/>
</li>
</ul>
<h3id="advanced">Advanced settings</h3>
<ul>
<li>YOURLS will look for the MySQL extension PDO, MySQLi or MySQL, in that order. If you want to force usage of one particular extension, add the following line to your <code>config.php</code>:<br/>
<li>You can install YOURLS behind a firewall or a proxy: see <ahref="http://yourls.org/proxy">Proxy Support</a></li>
<li>File <code>includes/load-yourls.php</code> contains a few more undocumented but self explanatory and commented settings. Add them to your own <code>config.php</code> if you know what you're doing.</li>
</ul>
</div>
<!-- YOURLS plugins -->
<divid="PluginsDiv"style="display:none">
<h2class='first'>Plugins for YOURLS</h2>
<h3id="plugins">Plugins?</h3>
<p>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.</p>
<p>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 and you can easily activate and deactivate a plugin from the admin interface.</p>
<p>There's a growing number of plugins available: check the <ahref="http://yourls.org/pluginlist">Plugin list</a>.</p>
<h3id="documentation">Documentation</h3>
<p>Several sample plugins are included in the archive. Read the source and learn the concept. It's easy and fun!</p>
<p>Check the <ahref="http://yourls.org/pluginapi">plugin API documentation</a> to learn more</p>
</div>
<!-- API -->
<divid="APIDiv"style="display:none">
<h2class='first'>YOURLS' API</h2>
<h3id="apifeatures">Features</h3>
<ul>
<li>Generate or get existing short URLs, with sequential or custom keyword</li>
<li>Get some statistics about your links: top clicked links, least clicked links, newest links</li>
<li>Output format: JSON, XML, or simple raw text</li>
<li>Authentify either with login/password or using a secure passwordless mechanism</li>
</ul>
<h3id="apiusage">Usage</h3>
<p>You need to send parameters to <code>http://your-own-domain-here.com/yourls-api.php</code> either via <code>GET</code> or <code>POST</code> (remember to <strong></strong>URL encode parameters</strong> if via GET). These parameters are:</p>
<ul>
<li>A valid <code>username</code> / <code>password</code> pair, or your <code>signature</code> (see <ahref="http://yourls.org/passwordlessapi">Passwordless API requests</a>)</li>
<li>The requested <code>action</code>: <tt>"shorturl"</tt> (get short URL for a link), <tt>"expand"</tt> (get long URL of a shorturl), <tt>"url-stats"</tt> (get stats about one short URL), <tt>"stats"</tt> (get stats about your links) or <tt>"db-stats"</tt> (get global link and click count)</li>
<li>With <tt>action = "shorturl"</tt> :
<ul>
<li>the <code>url</code> to shorten</li>
<li>optional <code>keyword</code> and <code>title</code> for custom short URLs</li>
<li>output <code>format</code>: either <tt>"jsonp"</tt>, <tt>"json"</tt>, <tt>"xml"</tt> or <tt>"simple"</tt></li>
</ul>
</li>
<li>With <tt>action = "expand"</tt> :
<ul>
<li>the <code>shorturl</code> to expand (can be either 'abc' or 'http://site/abc')</li>
<li>output <code>format</code>: either <tt>"jsonp"</tt>, <tt>"json"</tt>, <tt>"xml"</tt> or <tt>"simple"</tt></li>
</ul>
</li>
<li>With <tt>action = "url-stats"</tt> :
<ul>
<li>the <code>shorturl</code> for which to get stats (can be either 'abc' or 'http://site/abc')</li>
<li>output <code>format</code>: either <tt>"jsonp"</tt>, <tt>"json"</tt> or <tt>"xml"</tt></li>
</ul>
</li>
<li>With <tt>action = "stats"</tt> :
<ul>
<li>the <code>filter</code>: either <tt>"top"</tt>, <tt>"bottom"</tt> , <tt>"rand"</tt> or <tt>"last"</tt></li>
<li>the <code>limit</code> (maximum number of links to return)</li>
<li>output <code>format</code>: either <tt>"jsonp"</tt>, <tt>"json"</tt> or <tt>"xml"</tt></li>
</ul>
</li>
<li>With <tt>action = "db-stats"</tt> :
<ul>
<li>output <code>format</code>: either <tt>"jsonp"</tt>, <tt>"json"</tt> or <tt>"xml"</tt></li>
</ul>
</li>
</ul>
<h3id="apiexample">Sample requests</h3>
<p>Example of a <tt>GET</tt> request with Javascript (using jQuery) to shorten a URL</p>
<p>There's a sample PHP file included that serves as an example on how to play with the API</p>
<h3id="expand_api">Expand the API</h3>
<p>You can easily implement custom API actions with a plugin. See the <ahref="http://yourls.org/pluginlist">plugin list</a> for examples.</p>
</div>
<!-- FAQ Instructions -->
<divid="FAQDiv"style="display: none;">
<h2class='first'>FAQ</h2>
<h3id="requirement">Server requirements</h3>
<ol>
<li>A server with <strong>mod_rewrite</strong> enabled</li>
<li>At least <strong>PHP 5.2</strong></li>
<li>At least <strong>MYSQL 4.1</strong></li>
<li><em>Note</em>: YOURLS can also run on <ahref="https://github.com/YOURLS/YOURLS/wiki/Nginx-configuration">Nginx</a> and <ahref="http://www.ututech.com/2010/10/configuring-yourls-to-work-with-cherokee-web-server/">Cherokee</a></li>
<li>PHP <ahref="http://www.php.net/curl">CURL extension</a> installed if you plan on playing with the API</li>
</ul>
<h3id="limitations">Limitations</h3>
<ul>
<li>Maximum length of custom keyword is <strong>200 characters</strong></li>
<li>That makes about <strong>8 sexdecillions of centillions</strong> of available URLs (<ahref="http://en.wikipedia.org/wiki/Names_of_large_numbers">seriously</a>. That's a 355 digits number). </li>
</ul>
<h3id="base3662">Difference Between Base 36 And Base 62 Encoding</h3>
<ul>
<li>Base 36 encoding uses <code>0123456789abcdefghijklmnopqrstuvwxyz</code> for short URLs</li>
<li>Stick to one setting, don't change after you've created links as it will change all your short URLs!</li>
<li>Base 36 is the default and should be picked if you're not sure.</li>
</ul>
<h3id="shortdomain">Getting a short domain name for your YOURLS install</h3>
<ul>
<li>Unless you plan on making it public and as popular as bit.ly, any shared hosting will be fine. Ozh runs all his YOURLS instance on <ahref="http://yourls.org/dreamhost">Dreamhost</a> and it works just great.</li>
<li><ahref="http://domai.nr/">Domainr</a> is a fun search tool that might inspire and help you</li>
<li>Aim for exotic top level domains (.in, .im, .li ...), they're often cheap and a lot are still available. <ahref="https://www.gandi.net/domain/buy/search/">Gandi</a> is a pretty comprehensive registrar, for instance.</li>
</ul>
<h3id="htaccess">YOURLS needs its own .htaccess</h3>
<ul>
<li>You cannot install YOURLS and, say, WordPress, in the same directory. Both need to handle URLs differently and need their own <tt>.htaccess</tt> file.</li>
<li>If you want to install YOURLS on the same domain than your blog, give it its own (short) subdirectory, such as yourblog.com/s/ (for "short") or yourblog.com/x/ (for "exit")</li>
</ul>
<h3id="does404">If YOURLS generates 404 for your short URLs</h3>
<ul>
<li>Make sure <strong>mod_rewrite</strong> is enabled with your Apache server</li>
<li>Make sure your .htaccess file looks like <ahref="http://yourls.org/htaccess">this one</a></li>
<li>Eventually, check your server Apache configuration allows use of .htaccess (<tt>AllowOverride All</tt> directive, ask your server admin)</li>
</ul>
<h3id="noindex">There is no index page at the root of the install</h3>
<ul>
<li>Indeed. It's intented. It's up to the user to make what they need. Some will redirect the root to a different place, some make a public interface for anyone to shorten links, some make a portfolio. You make it.</li>
<li>If you want to make a public interface and run your own little bitly.com, there's a sample file provided as an example: <code>sample-public-front-page.txt</code>. This implies important issues to deal with: spam, performance and security. Read <ahref="http://yourls.org/public">Public Shortening</a> for important information.</li>
</ul>
<h3id="lowercase">Uppercase letters in short URLs are eaten up, eg "<code>OmgOzh</code>" becomes "<code>mgzh</code>" !</h3>
<ul>
<li>Indeed. It's intented if you selected Base 36 (see above). Letters that don't belong to the character set, eg <code>@#!</code> or <code>ABC</code>, are removed.</li>
<li>If you want to force lowercase, you'll need a <ahref="http://yourls.org/pluginlist">plugin</a>.</li>
</ul>
<h3id="feedback">Feedback, feature requests and bug reporting</h3>
<ol>
<li>Please don't get in touch directly by mail or Twitter. <ahref="http://yourls.org/support">Please</a>.</li>
<li>Check the <ahref="http://yourls.org/roadmap">Road Map</a> for future features.</li>
<li>Read all the <ahref="http://yourls.org/wiki">wiki documents</a>.</li>
<li>Search in all the <ahref="http://yourls.org/issues">issues</a>, open and closed.</li>
<li>Eventually raise a new issue. To do so, please read the <ahref="http://yourls.org/contribute">contribute guidelines</a>. Thanks!</li>
</ol>
</div>
<!-- More -->
<divid="MoreDiv"style="display: none;">
<h2class='first'>Community</h2>
<p>YOURLS is open source, so the community of users plays a great role in its development, by contributing, helping others or giving feedback that helps improve the software.</p>
<h3id="ressources">Resources</h3>
<ul>
<li>The official <ahref="http://blog.yourls.org">YOURLS blog</a>, for news, hints and showcase.</li>
<li>The <ahref="http://yourls.org/wiki">wiki</a>: advanced documentation, plugins, tips and more</li>
<li>Follow <ahref="https://twitter.com/YOURLS">@YOURLS</a> for hardcore development, and <ahref="https://twitter.com/ozh">@Ozh</a> for tips and news (and random geekiness too)</li>
</ul>
<h2id="showcase">Showcase</h2>
<h3>Here are a few examples of sites running YOURLS with a unique design or concept</h3>
<ul>
<li><ahref="http://oe.cd/">http://oe.cd/</a><br/>
OECD's internal URL shortener with a neat interface and private features</li>
Public YOURLS setup and early adopter, run by famous sex writer Violet Blue as "the internet's first and only sex-positive url shortener", once taken down by Libya (<ahref="http://www.readwriteweb.com/archives/libya_shuts_down_vbly_bitly_owly_next.php">story</a>)</li>
</ul>
<h2id="frameworks">YOURLS and other platforms or frameworks</h2>
There are numerous WordPress plugin with YOURLS support. <ahref="http://wordpress.org/extend/plugins/yourls-link-creator/">YOURLS Link Creator</a> is recommended.</li>
Simple app to have a global keyboard shortcut send a link to YOURLS</li>
<liid="android">Android: <ahref="https://play.google.com/store/apps/details?id=com.mndroid.apps.urly">URLy</a> and <ahref="https://play.google.com/store/apps/details?id=de.keineantwort.android.urlshortener">URL Shortener</a><br/>
Android apps that plays nice with YOURLS</li>
<liid="iphone">iOS: <ahref="http://shorttailapp.com/">ShortTail for YOURLS</a>, <ahref="http://itunes.apple.com/us/app/clicklytics-track-clicks-on/id444008024?mt=8">Clicklytics</a> and <ahref="https://itunes.apple.com/us/app/myyourls/id661934890?mt=8">myYOURLS</a><br/>