How to Make Your Own Custom URL Shortener

This is a technical post about what I’ve discovered in creating my own custom URL shortener.  Hopefully, you can learn to do the same things I did, and my experience will save you some headaches if it’s something you’re interesting in trying.

Short-and-Tall

On my website, I focus a lot about decisions and discovery.  I love finding out how the world works and then applying what I’ve learned to make better decisions, and I also try to share what I can along the way.  I hope that it helps others.

When it came to URL shortening, I was interested by a post from Michael Hyatt, who has a tutorial on how he created his own custom URL shortener.  I was intrigued, since he has a great how-to guide on his website.  However, I didn’t want to pay for an additional service, so I tried to find out how to create one myself and do it inexpensively.  Luckily, I discovered how to do it, and I’m happy with the results, so I thought I’d write this post to share my experience.

A couple things first, in case you’re new to the whole concept.

What is a URL?  URL stands for Universal Resource Locator, but you can think of it as the name of the website page you are trying to reach on the Internet.  http://www.nytimes.com, http://www.micfarris.com/about/, and http://espn.go.com/ are all examples of URLs that will take you places on the Web.

Next question, what is a URL shortener and why would I want to use one?  It’s a service that allows you to create a link to one of these pages, maybe one to somewhere on your website or anywhere else on the Internet, using a much shorter link name.  Bit.ly is such a service, and it’s the one that I use.  Here’s an example of why I like to shorten my URLs.

I have a post on my website about Stephen Hawking and his amazing ability to communicate, even though he suffers from ALS.  The link itself, as you can see below, is very long:

This link itself is 109 characters, so it takes up a lot of room.  Also, if I wanted to share this link on Twitter, I’d use up 109 of the 140 characters that Twitter allows.  If the link were longer, I might not be able to pass along the link at all!  It would be nice to shorten this link and let people reach this article while still providing a message to interest them in following the link.

I can do this by going to bit.ly and entering the URL itself.  Bit.ly will then create a shorter URL that will take me to exactly the same place:

and with my custom URL address, this link becomes:

There are a number of reasons why creating a custom short URL can be a benefit for you:

  • Using a URL shortener allows you to share more with others on Twitter and Facebook. When the links you share don’t take up so much space, you can focus on your message to your readers. And it becomes especially important when using Twitter, since you are only limited to 140 characters for your tweet.
  • You can keep track of the number of clicks your shared posts get, allowing you to better understand your readership. Bit.ly keeps track of the number of times people click your shortened links, so you can get a sense of which links are more popular and when people chose to click on them.
  • Making a custom URL shortener allows for more consistent branding. It’s great to use a URL shortener for sharing links with, say, your Twitter followers. However, if you’re able to do this while continuing to promote your website or business, then sharing this information with your followers becomes even more effective.

So, now that you know the benefits, are you ready to learn how to create one for yourself?  Great!

Here are the steps that I took in getting and setting up my custom short URL:

  • Buy the URL you’d like to use for URL shortening.  You will have one for your blog or website, but you’ll want to use a different URL for URL shortening.  Select one that brands yourself, your website, or your business well, but keep it short (otherwise it defeats the purpose!).
  • Twitter allows for 140 characters, so keep your shortening URL to 12 characters or less.  I use micfarris.us for my URL shortening, but the New York Times uses nyti.ms.  This way, you can tweet a shortened URL link (such as micfarris.us/WGtCik) and still have enough room to tweet a helpful message.
  • Check out available web addresses. You can go to http://domai.nr/ to check out available URLs.  I eventually chose micfarris.us for two reasons:
    • It contains “micfarris” to further the branding for myself and my website
    • The .us domains are a lot cheaper to purchase.  GoDaddy sells .us domains for $3.99 for the first year, so it’s an inexpensive way to get started.  I looked at getting micfarr.is (which is a domain from Iceland), but it cost $99/year, so I decided against it (for now!)

  • Connect with a URL shortening service to let them know your new domain name.  As I mentioned before, I use bit.ly – it’s free, and they do a great job with their URL shortening service.  Here are the steps for performing this step using bit.ly:
    • Sign in to your bit.ly account (or if you don’t have one, just create one)
    • Go to “Settings” from the upper right pull-down menu (or click here), click the “Advanced” tab, and then click the “Add a custom short domain” link.
    • Enter your new domain to assign it to your account

  • Connect your new domain to the website for your URL shortening service.  Here are the steps for performing this step using GoDaddy.com (the place that keeps my web address) and bit.ly (that performs the URL shortening):
    • Log into GoDaddy.com, click on “My Account”, then click on “Domains”
    • Click on the new domain you want to connect with bit.ly
    • Under the “DNS Manager” heading, click on the Launch link
    • The “A (Host)” record should be the first on the page, so we’ll want to change this to point to the bit.ly website.  You’ll want to change the IP address (the four number sequence in this record) to 69.58.188.49You should double check with bit.ly to make sure this is the right IP address (don’t just take my word for it!)  To double check the IP address and for more specific information from bit.ly, you can go here.
  • Wait patiently.  It can take up to 48 hours for the new information to propagate the right settings through the servers.  When I set up my custom short URL, it took less than an hour or so, but sometime it can take longer.
Setting up your own custom short URL for branding yourself, your website, and your business is easy.  It was surprisingly painless for me to set this up, and I’m sure that you can follow these simple steps to create your own, just like I did.

Question:  Have you ever thought about creating your own custom URL for Twitter?  Are there other short URL services that you like?  You can leave a comment below.

I serve as Director of Data Science & Analytics Engineering at Areté Associates. I've also served in leadership positions with Elanix, Inc. (now Agilent Technologies) and Mentor Graphics. I live in Thousand Oaks, CA, where I've served the public as Chair of our city's Planning Commission and our county's Tobacco Settlement Allocation Committee. I have been married to my wife Stephanie since 1993, and we have a wonderful daugther Monroe. Learn more about me »

Please note: I reserve the right to delete comments that are offensive or off-topic.

  • bjkeefe

    Thanks for sharing the info.

    One quibble: it is no longer necessary to shorten URLs for Twitter, which used to be my main interest in URL shortening. If you type in (or, more likely, paste) a long URL into a tweet you’re composing, you’ll notice that the character count goes up by far fewer than the number of characters in the URL, in real time. And even if you’re using “tweet this article” thing, passing along the full URL is no longer a problem — Twitter shortens them on the fly, at least in the sense of calculating the number of characters in your tweet.

    I do like to use a URL shortener when I want to obfuscate the actual URL for humor purposes — to avoid stepping on my own punchline, if you see what I’m saying. And I could well imagine that, had I not long ago concluded that I was never going to be Internet-famous, I’d like the personalization touch and all the tracking potential and so forth.

    So, thanks again.

    And how is your life going, otherwise? Long time no see.

  • http://www.micfarris.com/ Mic Farris

    You make a really good point. And I totally see your point about “hiding” the URL if what you’re sharing would be given away by forwarding the actual URL. Thanks for reaching out – great to hear from you!

  • Kristin Daniels

    Mic,
    Thanks for the great, very thorough explanation! Perfect!

  • http://www.micfarris.com/ Mic Farris

    Thanks, Kristin! I’m really happy that it was helpful for you!…

  • http://twitter.com/ColumbiaWilbert ColumbiaWilbert

    Thanks so much for this! Made a daunting task possible, took about 10 minutes! Now I can have my ColumbiaWilbertVault.com stuff sent as CWV.me. :)

  • http://www.micfarris.com/ Mic Farris

    My pleasure! I’m glad you found it helpful!

  • disqus_rSsVQnjmEv

    This was definitely helpful, thank you, Mic!

  • http://innerfatman.com/ Keegan Larson

    You can even redirect the top level domain used for the shortener inside the bit.ly settings for further customization (i.e. so micfarris.us goes to mcfarris.com instead of bit.ly homepage)

  • http://www.micfarris.com/ Mic Farris

    Glad I could help!

  • http://www.micfarris.com/ Mic Farris

    Great suggestion!…

  • $UP3R ||3RD

    http://bdb.im is well worth checking out, always mega fast for me

  • http://tomjamieson.com/ Tom Jamieson

    Hi Mic, I did the same thing for my site a couple of years back. I also did the bit.ly redirect so that my short URL tomj.us goes to my homepage tomjamieson.com instead of the bitly.com homepage. And you are right about the cost of some ccTLDs! I wanted to use tomj.am, but the 89/yr was a little cost prohibitive vs. the cost of .us instead.

  • http://www.micfarris.com/ Mic Farris

    Thanks, Tom!

  • John L. Rothra

    Mic, love the tutorial (though I don’t use GoDaddy). I had a question regarding the short domain name search site. I tried fbc.fc and it didn’t show in the list, as if it didn’t recognize the .fc part or something. Any thoughts what may be causing this?

  • http://www.micfarris.com Mic Farris

    Hi John – these URL suffixes (the last two letters after the “.”) are actually country codes. For example, *.us is the country code for the United States and *.is is for Iceland. It turns out that *.fc isn’t an established country code, so you wouldn’t be able to get a URL with that suffix. Here is a list of the approved country codes that you can work with – http://www.ibiblio.org/ais/url.htm. Hope this helps!

  • http://www.micfarris.com/ Mic Farris

    Hi John – these URL suffixes (the last two letters after the “.”) are actually country codes. For example, *.us is the country code for the United States and *.is is for Iceland. It turns out that *.fc isn’t an established country code, so you wouldn’t be able to get a URL with that suffix. Here is a list of the approved country codes that you can work with – http://www.ibiblio.org/ais/url.htm. Hope this helps!

  • Rap Linx

    Does this work if i have multiple websites under one hosting account?

  • http://www.micfarris.com/ Mic Farris

    It should – you can shorten the URL from ANY website and it will be linked using the custom short URL you create.

  • Pingback: Custom url shortener - Best Way to Generate Traffic - Feedingblog