How To Create Short URL’s on your WordPress Domain without a Plugin or Script

We see a lot of shortening services around and there are many free tools that will help you create one on your domain.

The logic is simple, there is a database, there is a long url and an associated short url. When someone access the short url, the long url is fetched from the database and the user is redirected.


Short URL Redirects to Long URL

If you are on WordPress you wont need any of those. Inherently, every post can be queried from the database using its post ID. For instance, this link and this link point to the same post.

Your short urls for all your WordPress post will be in the following format:

yourdomain.com/?p=POST_ID

To find the POST_ID of a post, just go to your Posts > Edit Page in WordPress Admin and hover over the title of the post and check the link on the status bar. The last number that you see is the POST_ID of the corresponding post. See the image:

WordPress Post ID on Status Bar

Now with this knowledge you could create your own Retweet Button’s and use the link in Twitter 🙂

Related: Handy Bookmarklets for 7 Popular URL Shortners

Hello, I am Arun Basil Lal. Thank you for reading!

I am a WordPress product developer and creator of Image Attributes Pro. I am passionate about solving problems and travelling the world.

Divi WordPress Theme - My Review

Divi WordPress Theme
Divi is a WordPress theme that web designers do not want you to know. It comes with a drag-and-drop theme builder. You can build beautiful looking unique websites without touching a line of code. Just choose from one of the many pre-made layouts, or pick elements and arrange them any way you like.

Divi is every WordPress developer's wet dream. Surprise your clients with neat responsive websites and have fun building them.

Divi comes from Elegant Themes. If you enjoy building websites, you *need* an Elegant Themes membership. 87 beautiful themes and 5 plugins for the cost of less than a candy-bar each!


Note: I am an avid user of Divi myself and this is a honest review. I wouldn't recommend something that I do not personally find amazing.

12 Comments.

  1. Ajith Edassery says:

    Oops.. I thought something really shorter than that is what you are talking about 😛

  2. Earn Money Online says:

    Whoa… Those are eastsheen cubes, am I right?

    I personally use Meta refresh for redirection 🙂

  3. Sathishkumar says:

    I never thought about this mate. Now i can use my domain’s short URL in tweets. Thanks for sharing this tip mate.

  4. This is not a good feature :(.

  5. BLOG404 says:

    I knew this , but you know , every time i delete that specific post , and create new one
    you get different url . The order is not maintained 🙁 by the way , i thought free short url like domain.com/abcd 😛

  6. Aravind Jose T. says:

    For those who are disappointed with the solution,
    http://kovshenin.com/wordpress/plugins/twitter-friendly-links/

    Nice & Easy!

    Good post, Arun.
    Even better is the self-clicked photo. 🙂

  7. thinsmek says:

    Have you not heard of wp.me yet? It is WordPress’ own shortlink service, only for wp blogs. It was released with version 2.7.

    You can located it just under the title of your post when you are editing it, next to the permalink. There is a button called “Get Shortlink” which will, when clicked, open a notification box with a shortlink like this: wp.me/pBZKD-3V

    To find out more, it is best to read this post from Matt http://wp.me/sf2B5-shorten

    This is great for Twitter! And the best thing is that all wp.me links will link to wordpress blog posts. Never to malware sites or other security-compromising websites.

  8. OrangeCopper Blog says:

    Nice article !!
    also check out the new google link shortner launched recently : http://orangecopper.com/blog/google-launched-google-url-shortner-called-goo-gl
    cheers
    Josh

  9. Sunil Sheoran says:

    This is good but what it would not hold if your domain URL itself is pretty long! What’s the character limit on these twitter or bit.ly short urls?

  10. Techinsert says:

    short url is very useful…thanks for the post…

Leave a Reply

Your email address will not be published. Required fields are marked *

*