Make your own short URLs with WordPress

You might have noticed that I recently restored the main URL of my site to https://danielkoskinen.com . I decided it was a better idea to have my full name in the URL, and use my other domain (dani.fi) to generate my very own short URLs for use in Twitter & elsewhere.

There are many good URL shortening services around, like bit.ly, twu.rl and the WP-centric wp.me, and I’m not saying there’s anything wrong with those. However, if like me, you happen to have a nice short domain lying around that you’d like to use, why not make your own?

Install WordTwit

WordTwit is a plugin for WordPress by BraveNewCode for integrating your WordPress website with your Twitter account. I owe big thanks to Mikko Saari for telling me about it. The reason why I liked this specific plugin is it’s feature for creating short URLs using your own domain.

You can install WordTwit either directly from your WordPress admin (under Plugins > Add new) or by downloading the zip and uploading it to your server under wp-content/plugins/.

Redirect short domain to longer domain

There are different ways to do this. Because I’m running this site on a dedicated server, I created a new VHOST entry for the second domain (dani.fi) and inserted the following:

   
<VirtualHost *>
   ServerName dani.fi
   Redirect 301 / https://danielkoskinen.com/
</VirtualHost>

Replace dani.fi with your own short domain name and danielkoskinen.com with the main domain for your site. If you’re running on a shared web host, you can probably just create a redirect in CPanel or equivalent.

Configure WordTwit settings

Enable WordTwit, find it’s settings page and the section marked URL Shortening. Choose “Local” from the menu and save your settings. This will reload the page and reveal more options. You can now enter your short domain in the field marked “Use Alternate Domain”.

Save your settings, and you’re done!

Try it out

Go to edit any post, and you’ll find the short URL for the current post in the right sidebar, using your new nice-and-short domain name! There’s also a button to post a message to Twitter (which can be set up automatically for new posts with WordTwit).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: