How To Create Your Own URL Shortening Service

image Today, I launched my own URL shortening service called xURLs

and I’m going to show you how you can easily create your own too.  But first, here’s a little background about URL shortening and why it’s an important aspect of your social media, affiliate marketing, press release, and even search engine optimization strategy.

For those of you who aren’t familiar with URL shortening, here’s a quick example of when you may want to chop a long URL down to something smaller.  Let’s say you want to post a link to a specific page on a shopping website for home office furniture in your tweet on Twitter. Unfortunately, the URL you want to include is 133 characters long which doesn’t leave space to talk about much else in your tweet.  You can reduce the length of the link by submitting it a URL shortening service which outputs a shorter URL that takes the user to the same exact page for you to use in your tweet, as in the example below:

Original URL (133 characters): http://www.thehomeofficedepot.com/shop.php?c=500&n=1069102&i=B00252CGL2&x=Cherry_Finish_Home_Office_Corner_
Workstation_Computer_Desk

New Short URL (17 characters): http://xurls.us/3

As you can see, the new URL is 116 characters shorter than the original link, resolves to the exact same pages, and is now Twitter friendly.

Lately, I have been doing a lot with Twitter and affiliate marketing.  In doing so, I’ve come to recognize the importance of “URL control” in posting links on social media networks and within my own affiliate promotional pieces.  There are many services out there that allow people to shorten URLs.  The most well known of these websites are bit.ly and TinyURL, but there are tons of others, each with its own unique features.

It occurred to me that given the relative simplicity of these services that it would be easy to set-up and host my own URL shortening/redirection services using a domain I own.  Having my own URL reduction website gives me the ability to shorten URLs, incorporate keywords of my choosing, view click statistics and user information, set my own redirection rules, and add advertising.  In other words, as a web marketer, I now have the ability to abbreviate links with custom characteristics while gaining valuable analytical insight.

Steps To Create Your Own Domain Redirection Service

What follows is a basic overview of how to get your URL shortening website up and running pretty quickly.

1.  Find the shortest available domain name you can

I’ve been using Bustaname.com to help find some very good unregistered website domain names for a while now.  It was Bustaname.com that enable me to find xURLs.us (the URL for my domain name shortening service) which is a beautifully short and descriptive 8 character (including the period) domain name.  Many URL reduction websites use exotic two-letter, top level domains (TLD) like .al, .cc, .ly.  These are great because they are shorter than the classic “.com” TLD, but they can cost you anywhere from $10 – $90 to reserve.  Please note: many of country-specific TLDs have special criteria that must be met in order to reserve them.  You can also use the little domain availability tool below to quickly check if a website name is available. 

5 free Domains with Select Hosting Plans. Get yours!


 

Once you’ve settled on a short domain name, the next step is to register it.  I use 1&1 Internet for domain registration.  It’s quick, easy, and cheap.  Others may prefer www.GoDaddy.com .

2.  Get reliable hosting

Most of the URL shortening services I came across researching this project are built upon PHP and MySQL, so I’d recommend a server host that comes with these two already installed.  Again, I use 1&1 Internet for server hosting, but you should use the web host you feel most comfortable using.

3.  Select a URL shortening script

It seems to be fairly easy for experienced web programmers to write their own custom URL redirection script, but why reinvent the wheel?  There are a few dozen free URL shortening scripts out there and some paid applications for you to select from.

xURLs is built upon a simple PHP script called Yourls.  I chose Yourls as my redirection platform because it’s free, has an easy installation, a straightforward admin interface, and a decent statistics package.

The admin console for Yourls:

Yourls admin console screenshot

The stat package in Yourls:

Yourls statistic package screenshot.

Some other URL shortening scripts include: Kissa.be, Shorty, and TightURL.

Each script has its own mini-URL creation procedures.  For example, some present the target page in an iframe of a dynamically generated page, while others use a 301 HTTP redirect or even a Meta refresh as the mechanism to get users to the intended page.  Some scripts allow you to create multiple mini-URLs which point to a single long URL.  You should demo, research, and analyze how each script works and select the one that fits your needs.

4.  Install and customize the shortening script

Next, after you have selected a domain shortening script, you’ll need to install it in your web host environment.  You should review the installation documentation for the specific URL shortening script you selected, but for the most part they all involve roughly the same steps:  (1)create a SQL database (2)populate database connection parameters in a PHP set-up file (3)toggle settings in a configuration file (4)upload the files for the URL shortening application to your web server via FTP (5)initiate an installation/customization script.

If you’re using Yourls, you should review its installation instructions and this important note about installing Yourls on a 1&1 web server.  Also, some of you may not want your URL shortening service to be available for public use.  In this case, you will need to password protect your website.  Yourls allows you to do this quickly by changing the line “define(‘YOURLS_PRIVATE’, true);” in the config-sample.php to “true”.

As a nice little feature to get your started, Yourls includes a file called sample-public-front-page.php.txt to give you an idea about how to construct the homepage for your URL shortening website.  You can customize the contents of this file to your liking.  When you’re finished designing your homepage, change the file name to index.php and upload it to the root directory of your website.  I’d recommend designing a decent looking homepage and installing visitor tracking (i.e. Google Analytics, GoStats) for your URL reduction website – you never know when curious users may come-a-knocking.

5.  Start posting your short links

Now that your URL redirection script is up and running under your own domain, it’s time to start posting your short links on Twitter, Facebook, and your own affiliate websites.  Here’s an image of xURLs, my own URL chopping website, at work in the wild.

Xurls on Twitter screenshot

If you want to see something amazing, try posting a link routed through your URL shortening/redirection service in a tweet and immediately jump over to the statistics screen and watch how fast the clicks accumulate.


FREE Video Training for Internet Marketers

Get insider tips on how to make more money from your internet marketing efforts. Here’s what you get:

  •    Ultimate Entrepreneur eCourse
  •    The Online Profit Training
  •    SEO Traffic Building Coaching Call (pre-recorded)
  •    Blogging for Newbies eCourse

We respect your privacy. Your information will not be shared with any third party and you can unsubscribe at any time


Facebook Comments:

Leave A Reply (2 comments so far)

The comments are closed.


  1. Tungsten Carbide :
    933 days ago

    free domains are actually given by most hosting companies if you sign up to them “”


  2. Bvk
    793 days ago

    Nice article !

    I am using this yourls for one year. But I have not made it to public as I don’t know where to put sample-public-front-page.php.txt . Earlier I have moved it to ‘ /includes ‘ folder and got an error.

    By reading your article I have moved it to ‘ root ‘ renaming it as index.php. It worked for me. Anyhow, could you please tell me where to put other files like

    1)sample-remote-api-call.php.txt
    2)sample-public-api.php.txt

    Please also let me know if there is any other advanced configuration needed for better management

    Thank you!

"Stop Struggling To Earn An Online Income:
Get Our FREE Video Training for Internet Marketers"

Loading the player ...
Sign-up and Get:
  • The Online Profit Course
  • The Ultimate Entrepreneur eCourse
  • SEO Coaching Call

Complete the form below and receive instant access:
We respect your privacy. We will not sell or rent your email address to third parties. View our responsible email communications pledge.

Close