You are here: Home » WP Guides » How to Create a Customized Short URL For Your WordPress Blog

How to Create a Customized Short URL For Your WordPress Blog

Learning from the Best and using Your own shortened URL :

url shortnerThe Twitter social network has had such a great impact on the web, with its 140 character limit, that  many URL shortening tools were created. As users, we can use any URL shortening tool, like ow.ly for example, but it wouldn’t look very professional. So some people have started taking the steps of the big websites in the industry. Youtube has youtu.be, The New York Times has nyti.ms  … why shouldn’t you have your own short URL service ?

 

Aside from the fact that it looks really cool and  tech-savvy, the reasons why you might want to have short URLs for your own blog are mostly connected with branding. Aside from that, the original reason still applies – you need URLs which are short enough to be posted on Twitter. As for branding, the idea is this – you build a better image for your website or website network, and one day, that brand image works for you. As simple as that. But what are the ways to do this ? Wouldn’t it be too complicated ?

Shorter URLs on the same domain

You could bother doing your own redirect plugin, but like with most other common problems, there’s no need to reinvent the wheel. There already are plugins that were written to do this. If you need to have shortened URLs with your own domain name (they look similar to TinyURL addresses – example.com/33ks8s), you might give Link Shortcut  a try. This handy plugin does all the hard work for you, with little or no configuration.

 url shortner 2

Now if you want your Tweet button to tweet this shortened URL, you might have to do some modifications which will parse the shortened URL instead of the long one. This can happen with the following code snippet, provided by BBQ Addicts:

/* Grab Custom Short URL */
function grab_short_url() {
mysql_connect(“localhost”,”username”,”password”) or die(mysql_error());
mysql_select_DB(“database_name”);
$result = mysql_query(“SELECT * FROM wp_linkshortcut WHERE
url=’http://example.com” . $_SERVER["REQUEST_URI"] . “‘”);
if (mysql_num_rows($result)==0) {
$short_url = “http://example.com” . $_SERVER["REQUEST_URI"] . “”;
echo $short_url;
} else {
$short_url = “http://example.com/” . mysql_result($result,0,ident) . “”;
echo $short_url;
}
mysql_close();
}

Of course, you should replace http://example.com with your own URL if you want this snippet to work.

Using A Different Domain for Shortened URLs

This would be a lot more difficult if it wasn’t for the perfect service offered by bit.ly. Few of us could write their own configuration to generate shortened URL redirection. Bit.ly not only offers to do that for us with very little configuration, but also keeps track of our activity and provides us with the statistics, which we could analyze to measure our progress with shortened URLs.

So let’s take a step by step walkthrough of what needs to be done:

  1. Buy a new domain name. This can happen through many sites on the Internet and we feel it’s unnecessary to recommend a particular one. Just make sure it’s short, because otherwise it would defeat the purpose of doing all of this.
  2. Register at Bit.ly for a Pro Beta account.
  3. Set up your existing domain’s DNS server to point to Bit.ly. If you’ve bought your domain name from Godaddy.com, you can go to the Total DNS tab in their control panel, look for the
    “A Record”, and point to this IP address : 168.143.174.97  (this is the IP address Bit.ly uses)

short url2

  • Confirm and validate that you own the existing domain. Bit.ly will give you instructions on how exactly that’s supposed to happen.

This method comes with a price, but on the other hand it offers you the unique ability to express yourself on the web. You’ll look more professional, and having a short URL that represents your brand will be very useful in the long run.

 

About admin

Ajinkya Thete is passionate Blogger,a self-taught web developer and a person who is always looking for innovation.

2 comments

  1. Amazing and most informative post which Ive seen so far. Thanks for sharing.

  2. You can also create it if you know well knowledge of php and mysql

Leave a Reply

Scroll To Top