Creating a Custom URL Shortener using Bit.ly
If you’ve come to this site by way of Twitter or Facebook, you may have noticed that the short link for all of these posts isn’t your typical URL. I recently purchased snv.me to shorten all of the links to my blog posts and site, and (after some extensive research) found a way to hook it into my site using bit.ly’s pro service (now open to everyone!)
Find a Domain
You’d think this would be the easy part, but you may be mistaken. Finding a good top-level domain (TLD) that matches your current site may or may not be difficult, but it depends on where you’re willing to look. Namecheap has the following extensions: ws, ca, org.uk, in, cc, de, bz, tv, eu, nu, me, us, and co. All of these two letter domains work fantastic for shortened URLs. I chose SNV.ME because it has a nice ring, but you may find something that fits your taste.
If you’re looking for something more exotic, domai.nr can look outside of the US/EU to find TLD’s that may work. Keep in mind some of them may have additional costs and/or restrictions.
At one point, Bit.ly charged for their pro service. Now, anyone can take advantage of the power of the bit.ly URL shortener with whatever domain you want – and it’s a fairly easy set-up process.
- Create an account / log in to bit.ly
- Click on “Settings” under the drop-down
- Under the Advanced tab’s “Custom Short Domain” click on the “Add a Custom Short Domain” link
- The system will give you instructions on how to add bit.ly’s IP address to your domain.
- Log in to your domain registrar and click on your DNS settings (this will differ depending on who you’ve registered with).
- Add an A record for the IP address with your short domain.
Once that’s done, you can install the Bit.ly Shortlinks plugin. This will allow you to manage everything automatically through WordPress. However, there is a small bit of core-file editing to do (nothing major). Edit your wp-config.php and paste in the following code:
/** * Settings for Bit.ly Shortlinks Plugin * http://yoast.com/wordpress/bitly-shortlinks/ **/ define('BITLY_USERNAME', 'BIT.LY-USERNAME'); define('BITLY_APIKEY', 'API-KEY');
Your API key can be gotten by heading back to bit.ly and clicking on the settings tab – it’ll be midway down the page.
Now, when you create a new post, you can click the “get shortlink” button and Voila! You can access your new shortlink and paste it wherever you wish.