Why Not Just Use Some URL Shortening Service?
If you’re arriving at this article directly, head back to part one to read about why to make your own short urls.
In a nutshell, I’ll summarize the whole article by saying that asking people to trust a cloaked link is not something you should ask anyone to do.
Methods of Shortening URLs
There are several different ways to handle URL shortening, and I’m going to list as many as I can think of here.
For WordPress Self-Install Users
If you use WordPress, you have it fairly easy. Remember back to the day you installed WordPress and you had those ‘ugly’ urls that were just your domain and a number? Did you realize those URLs still work? They do, nowadays they just redirect to whatever nice readable format you changed your permalinks to be (which I’m sure you did, riiighhht?).
In fact, you users have two options. Use a plugin or add the code yourself.
The Plugin Option:
A good one is la petite url which uses your own domain to make your short url. When you save a post it shows the short url in the sidebar of your administrative interface. You can then drag this into your post. If you’re comfortable editing your theme files, you can add a bit of code to your single and page files so that it shows up automatically. It’s available on the WordPress Plugin repository here: la petite url
The Template Option:
Just head into your template editor and add a link to your short url into your Single and Page files. This should work fine for most templates, although a highly customized one may have different page types that you will need to add this to separately.
For a simple text display of the link, add the following code where ever you want in your theme file:
<span>Short URL: <?php get_bloginfo('url'); ?>/?<?php the_ID(); ?></span>
If you want to use a textbox type of display where people can easily select the text, try a variation on something like this:
<span>Short URL: <input type="text" value="<?php get_bloginfo('url'); ?>/?<?php the_ID(); ?>" style="width:50%;"/></span>
For WordPress.com Users
As you know, you can’t install plugins or edit template code if you have a WordPress.com blog. You can, however, still make your links a bit shorter than they are now because your posts still have a numeric version available.
You would need to add (manually) text at the bottom of your posts to provide the short link to your visitors. The link would look like this:
But how do you find the POST ID for a WordPress.com blog? It’s not hard at all. I’m going to provide two screenshots to show you where to find it.
From the posts list screen:
From the editing screen:
Remember, for WordPress.com people, this means adding that at the bottom of your posts when you make them.
The series so far:
Part 1: I Don’t Trust Short URL’s
Part 2: This article
Part 3: Make Your Own Short URLs in EE, MT, Joomla and Drupal
Part 4: Make Your Own Short URLs With Domains or Software