Fallback Domain Redirect with UTM Plugin for YOURLS Custom URL Shortener

Last updated on October 25th, 2018

If you have a website, you probably use a link shortener or have considered getting one before. In case anyone isn’t familiar, basically it allows you to easily redirect short URLs to longer “complete” URLs on your site. There are many reasons to do this, like visitor traffic analytics, marketing, user experience or the constraints of social media. Thankfully, YOURLS makes creating your own custom URL shortener quick and painless! Nonetheless, registering a custom domain just for occasional link shortening can feel a bit wasteful. That’s why I created the ‘Fallback Domain Redirect with UTM’ Plugin for YOURLS, to give the domain a second purpose! Both are free and easy to use, so if you own a hosting plan, consider giving it a shot!

What this Fallback Domain Redirect plugin does

  • The plugin redirects the original URL (link) path to the fallback domain like a wildcard redirect.
  • It can also (optionally) add UTM parameters such as utm_source, utm_medium & utm_campaign to the redirected URL.
  • If you want, it can also remove any pre-existing UTM parameters, if they were already in place prior to the redirect.
  • Of course, if the “sho.rt” keyword already exists, it doesn’t do anything. That way you can still use your custom URL shortener like you always have.

How you can use it in practice

To set up the 'Fallback Domain Redirect with UTM Parameters Plugin', it just takes a moment in your YOURLS backend.
To set up the plugin, it just takes a moment in your YOURLS backend.

After installing and filling in the fallback domain in the settings, you can start using the plugin straight away! Any URL that isn’t a keyword will automatically redirect to the respective URL on your main fallback domain. In case that doesn’t fully explain things, here’s an example:

Say your main WordPress website or store is: https://www.JamesTampaBaySportsBar.com/

On the other hand, the domain for your YOURLS domain is: https://JSBar.co

If you just want to use your shorter, easy-to-spell domain to visit already-existing pages on the main domain, you could use this plugin to do that. Without having to set up a shortlink before hand, you could make the following wildcard redirect:

JSBar.co/Events/Live-Music/October/Week-[2]

automatically redirects to ↴

https://www.JamesTampaBaySportsBar.com/Events/Live-Music/October/Week-[2]

Additionally, it can also add UTM parameters in the process. That could make the final redirect:

https://www.JamesTampaBaySportsBar.com/Events/Live-Music/October/Week-[2]/?utm_source=JSBar.co&utm_medium=yourls&utm_campaign=promo_flier

Depending on how you use your site, this may very well be a useful feature to have available. Heck, I even use it as a shortcut to certain pages when I’m typing URLs manually. If the only reason you have YOURLS installed is for occasional URL shortening, this fallback domain redirect plugin is an awesome way to make your YOURLS even more useful!

Finally, keep in mind that you still get to keep using your YOURLS installation like you always have. This plugin doesn’t interfere in any way with short links to existing keywords.

What’s the ‘UTM Parameters’ thing about?

Not much, actually. If you don’t know what it is – and aren’t interested in finding it out – don’t worry about it. Just leave the boxes in the plugin blank.

If you are curious, its sole purpose is simply to identify how people are reaching your website. In other words, basically it’s just for your own statistical purposes in Google Analytics. It’ll distinguish people who arrive at your site via the fallback domain redirect, as opposed to using the full link.

All in all, it’s just added information at your disposal with no downside to using them if you already use Google Analytics on your site. And the UTM parameters will disappear from the URL as soon as the visitor clicks any link on your site.

For more info, check out the plugin’s page on Github

For more info, check out the official page for the ‘Fallback Domain Redirect with UTM’ Plugin on Github. There you’ll find plenty of additional information.

For more specific issues, check out the Wiki & Frequently Asked Questions page. I hate add-ons or programs that you have to install only to find out it doesn’t do what you expected. Via the link you’ll find answers to just about any question that anyone might have about the ‘Fallback Domain Redirect with UTM’ plugin.

Download the ‘Fallback Domain Redirect with UTM Parameters’ Plugin

To download and install the plugin, all you have to do is go to the following link on Github and download the corresponding folder. You can find it here: Github – Fallback Domain Redirect with UTM Plugin. It’s open-source so you can even check out the code if you want.

If you need any help installing it, check out Installation Notes in the Readme file.

Tip – Get a free domain name to try it out

Are you curious about having your own custom url shortener, but don’t want to buy a domain name just yet? If you already have a multi-domain hosting available, you can get a free .tk domain name to try it out. It only takes a few minutes at dot.tk.

For short-term testing purposes there’s no catch. In the long-term, the restraints are mainly that you have to renew it (for free) every few months, and that if you let the page fall into disuse they might put a landing page on it. Personally, I just use it for testing purposes. But if all you want is a free domain for a few weeks to test out YOURLS (and this plugin), it’s a great option.

The Takeaway

Having your own custom link shortener is pretty cool in that nerdy kind of way. The Fallback Domain Redirect with UTM Plugin will simply give you another option when it comes to how to use YOURLS. If you think that might have some value for you, then great! Just download it and give it a try.

Anyway, thanks for reading! I hope you’ve found this useful. If you did, consider subscribing or sending a donation my way. Either is appreciated.  In any case, have a good one!

Got any tips, suggestions or questions? Leave a comment below.