Did You Know WordPress Has It’s Own URL-Shortener Built In?

Filed as Guides on April 23, 2009 12:50 am

Recently an email subscriber complained that I had sent out a newsletter containing links shortened via a URL shortner service.

There are a couple of reasons I did this. First if a URL is too long email programs break the links by wrapping. This means I get a lot of people saying the links don’t work. The second reason is in the past Aweber’s built-in click tracking shortened URLs have broken also when the URL contained non-standard stuff.

Of course the problem when people see a URL-shortened link is they don’t know if they can trust it. I have three solutions, and they are all easy to implement on WordPress.

  1. Shrink your URLs down as far as they will go – Instead of www.somedomain.com/category/year/month/day/post use a URL scheme like mydomain.com/post
  2. Use a redirect plugin such as gocodes to turn a long fancy URL into something like http://chrisg.com/recommends/hosting
  3. WordPress already provide you with pre-shortened URLs, you just need to know where to find them! :)

Waaah?

Yes, indeed. You already have access to short URLs without changing or adding anything.

If you go into your control panel and look at editing your post, you will see an article ID. Simply use that instead of the prettier and friendlier URL. Eg. http://f1ftw.com/?p=28 goes to http://f1ftw.com/fantasy-f1/vettel-takes-china/ (of course it helps when your domain is 5 characters not including the TLD).

Copy the number that comes after Post= - that's your post ID

Tags: , ,

This post was written by

You can visit the for a short bio, more posts, and other information about the author.


Submissions & Subscriptions

Submit the post to Reddit, StumbleUpon, Digg or Del.icio.us.

Did you like it? Then subscribe to our RSS feed!



  1. By CMD posted on April 23, 2009 at 1:01 am
    Want an avatar? Get a gravatar! • You can link to this comment

    Chris,

    thanks for the advice and notice. I didn’t know about this. I have heard some bloggers, etc. worrying about a web of broken urls – the domain name would fix that. what’s their beef anyhow, do you know?

    Reply

  2. By Lynette Chandler posted on April 23, 2009 at 1:13 am
    Want an avatar? Get a gravatar! • You can link to this comment

    Yes but of course! *slaps head* Just use WP default URLs – like they were before activating permalinks. Brilliant.

    Sometimes the answers to our questions are the most obvious (and simplest). Thanks Chris for the reminder

    Reply

  3. By Harsh Agrawal posted on April 23, 2009 at 1:18 am
    Want an avatar? Get a gravatar! • You can link to this comment

    That’s a nice find, but Still need to figure out how I can use for my affiliate links

    Reply

  4. By redwall_hp posted on April 23, 2009 at 1:26 am
    Want an avatar? Get a gravatar! • You can link to this comment

    Thanks for the GoCodes mention. :)

    And if you go with the WP default p=123 method, you can shorten the URL down even more by editing your .htaccess file and redirecting example.org/123 to example.org?p=123.

    Reply

  5. By John (Human3rror) posted on April 23, 2009 at 1:52 am
    Want an avatar? Get a gravatar! • You can link to this comment

    I wrote this just the other day!

    same concept.

    Reply

  6. By Lorelle VanFossen posted on April 23, 2009 at 5:54 am
    Want an avatar? Get a gravatar! • You can link to this comment

    A reminder to WordPress users that if you have a site with a lot of content, it is recommended that a number be in your pretty permalink to speed up the process of finding your post in the database. A pretty permalink like example.com/2009/post-title works better than example.com/post-title/, though the time delay is almost unmeasurable from what I understand. There’s been a lot of discussion about this recently in the WordPress Community.

    When you use a link shortening service, it goes out to the service and goes through their database to pull out the post set for that URL. This can take a little extra time to process the page, but it also can backfire if that link shortening services closes. I recommend using the default WordPress method per your examples, Chris, or sticking with one that has been around for a long time and has a lot of support from the community.

    Great suggestion, Chris.

    Reply

  7. By `rolandinsh` posted on April 23, 2009 at 12:39 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    For short links in my blogs I’m using in footer of post my.domain.tld/?p=22 And using it for several “share services” or simply selectable input field

    Reply

  8. By Andy Merrett posted on April 23, 2009 at 1:21 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    Slightly OT, but what’s also annoying is when Twitter (web interface at least) automatically shortens longer URLs even when there’s room for them. Not sure what the threshold is; anyone know?

    I can imagine using one of my domain names and a shorter URL in this way, but it still being turned into a TinyURL by Twitter (none of my domain names are particularly short – at least 10-15 characters each not including TLDs)

    Reply

  9. By squareart posted on April 23, 2009 at 1:46 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    Thanks for this, looking forward to trying out the GoCodes plugin.

    Reply

  10. By krishna posted on April 23, 2009 at 2:44 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    This is a good find regarding the URL-shortener in WordPress. Thanks for sharing it here

    Reply

  11. By aks posted on December 11, 2009 at 11:02 am
    Want an avatar? Get a gravatar! • You can link to this comment

    wow never heard this thing. thanks for sharing.

    Reply

  12. By Jason Burns posted on December 16, 2010 at 9:36 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    That’s great if you want to take the time to look it up every time. Not to mention that you only want to know what happens with links that are native to your own domain. I set up a shortner and I like that it’s automatic with Tweetdeck for any link I paste in, and I can see how much it gets viewed.

    Reply

    Your words are your own, so be nice and helpful if you can. If this is the first time you're posting a comment, it might go into moderation. Don't worry, it's not lost, so there's no need to repost it! We accept clean XHTML in comments, but don't overdo it please.

    Current day month ye@r *