A URL shortener is a service that takes in a long URL and gives you a short and memorable URL that you can distribute to anyone you want. The service takes care of redirecting users who land up at the shortened URL to the original URL.
TinyURL, of course, was one of the pioneers in the field but ever since Micro blogging sites like Twitter started to take off, a number of services have come up that all provide essentially the same URL shortening service.
One major problem with using a third-party URL shortening service is that all your links are always bound to that one service and if they ever go out of business, like tr.im did, all your data is gone too. And that is why, if you’re serious about saving all the wonderful links that you’ve discovered from around the web, you might want to consider running your own URL shortening service.
YOURLS gives you exactly that.
First of all, you need to download YOURLS to your web server and unzip the package.
Now, use your favorite tool to create a mysql database for YOURLS. If you’re using a shared hosting provider, there must be a way to do this from inside your domain control panel. If not, just open a ticket with your hosting provider and let them handle it for you. I named my database ‘kunz_yourls‘.
Now, browse over to the includes directory and rename the file named ‘config-sample.php’ to ‘config.php’.
Open ‘config.php’ in a text editor and edit the following variables.
The comments in the file are pretty self explanatory and you can also get an overview here.
Now, from your web browser, visit the site http://<website>/admin, where website is the domain name where you installed YOURLS. Click the “Install YOURLS” button.
If all went well, you will see the following message which means that YOURLS was successfully installed on your domain.
Start creating your own Short URLs
Browse over to http://<website>/admin/index.php and login using the username/password combination that you entered earlier in config.php. If you didn’t enter any, try username/password. That’s the default combination and that is why you should change it when you’re installing YOURLS.
Upon login, you’ll be able to create short URLs easily by just entering the complete URL in the prominently displayed text box and clicking “Shorten the URL” button.
You can even get some nice and simple statistics about the short URLs that you’ve created.
YOURLS also provides an API that you can take advantage of in custom applications and such.
Did you find YOURLS useful? Will you use it over, say, bit.ly? Let us know in the comments.
Our latest tutorials delivered straight to your inbox