Your Own URL Shortening Service
URL Shortening is extremely useful when it comes to sharing URLs on IMs or Twitter and is easy to be read and remembered by humans. And TinyURL has been doing this for years and is perhaps the most famous Shortening Service with its easy-to-use API along with Bit.ly.
Shorty is a very simple PHP based URL Shortening script. As this works on PHP, you’ll obviously need Linux Hosting / Apache Server. If you don’t have, you look for some free PHP Hosting. You’ll also have to create a MySQL Database to store shortened addresses and its link. You’ll learn about it in the next few steps.
Here’s all that you need:
- PHP (Apache Server/Linux Hosting)
- 1 MySQL Database (new or existing)
- FTP/File Uploader
- Shorty Script
- Few minutes of your valuable time
Ready to go? Follow the steps below
Download Shorty Beta here. Once you have downloaded Shorty, unpack the ZIP archive and upload/FTP the files to a folder (or) subdomain in your site (eg: ‘go’ , so that Shorty files will be in yourdomain.com/go).
You’ll have to configure Shorty by editing configuration.php. You’ll have update it with your MySQL Username and Password and the Database name. You can use an existing Database or create a new one. Please use your Control Panel (cPanel, DirectAdmin, VistaPanel, hosting based) to create one. If you are not sure, contact your hosting provider.
Now, open configuration.php. You’ll have to edit the following lines.
$db[‘server’] = ‘localhost’;
$db[‘username’] = ‘username’;
$db[‘password’] = ‘password’;
$db[‘database’] = ‘databaseName’;
$main_table = ‘shorty_shorties’;
$user_table = ‘shorty_users’;
username is your MySQL User (eg: yourhost_username) and password is your MySQL user’s password. Similarly, databaseName is the name of your database (eg: yourhost_database). Once you have changed these fields to point to your database, save it and proceed to Installation.
Note: Advanced users can edit the $main_table & $user_table values to point to the name of the Database tables you wish to create. The value of $main_table will be the table to store redirection and $user_table will be the table to store Shorty user accounts.
Updated Configuration.php? If so, you are all set to get back to GUI :)
You’ll have to install Shorty by running the self-installation located at http://yourhost.com/go/_install.php, where ‘go’ is the directory in which you have placed Shorty files in. This installation will create the administrator account for you. Now, key in your the username you wish to create, password and your email and click Install. If your installation was successful, you’ll presented with a page stating that your installation was successful.
Be sure to remove _install.php after you’ve installed.
You can now login and start creating short URLs on your very own Shortening Service. :)
Can you post any sample short URL?
Hi Prabhav, here you go!
http://josephcs.com/go/ubuntu/ redirects to http://www.josephcs.com/blog/computers/ubuntu-ins… with Google Analytics’ Source & Medium in action! :)
Hi Joseph, This is really great! We can short a URL in our own domain.
This is pretty nifty info to have, personalized shortened URL is very useful to know as it gives an idea where you might land up instead of trusting the source blindly which has shared the short URL
You should also try YOURLS, its pretty easy, fast and great!!
Sounds pretty cool. Lets try it :)
Hey, I’m using CCIhosting (offshore) with a Windows shared server running plesk and I’m having all kinds of problems trying to get this shorty script up and going. Any chance I could borrow or even buy your services with this? Thanks so much man, it is appreciated.
Sorry for the late response, was engaged with other stuffs. Coming to your issue, the shortening script used here has been made using PHP and is MySQL driven, and the same will run only on UNIX based servers. You can try to get a Linux shared web hosting to try the script. If you find getting a paid Linux web hosting just to try the script a costly job, you can find many free linux web hosting providers with a quick search on Google. Hope this helps. :)