Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
62 lines (43 sloc) 5.23 KB

Fallback Domain Redirect with UTM Parameters Plugin

Fallback Domain Redirect with UTM Parameters Plugin

This light-weight plugin for YOURLS allows your link-shortener to work double-duty. While still being able to create shortlinks as normal, it also allows you to use the domain of your URL shortener as a wildcard redirect to your main site. Without having to set up the link beforehand.

What this plugin does

  • Redirects the original URL path to the fallback domain like a wildcard redirect.
  • Optional - Adds UTM parameters - utm_source, utm_medium & utm_campaign can be added upon redirect to the fallback domain.
  • Optional - Removes any UTM parameters if present before redirecting to the fallback domain.
  • If the sho.rt keyword exists, it doesn't interfere. You can keep using your link shortener as you always have.


Say your main WordPress website or store is:

On the other hand, the domain for your YOURLS domain is:

If you're on the go, at an event or simply posting on a forum, a shorter easy-to-spell domain might be appreciated. Using this plugin, and without having to set up a shortlink before hand, you could make the following wildcard redirect:[1] auto-redirects to ↴[1]

Or, it can also add UTM parameters, making the redirect:[1]/?

It certainly is convenient for one-time use URLS to write on the back of a business card or whatever. Or even just for your own benefit as as an abbreviation for any page on your website. Such as to directly go to frequently visited pages like /contact/ or /login/. If you're just using your short domain to make shortlinks for your blog, this plugin is a great way to make YOURLS even more versatile! Plus it's quick to set up and free to use.

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

Why add UTM Parameters?

It's just the cherry on top. You don't have to use them if they don't provide any value to you. Its purpose is to distinguish people using that link from direct traffic. If you want to know how much use you're getting out of these redirects, you'd be able to see how many people clicked or typed-in your short link. This will help you better assess if the cost and hassle of maintaining an extra domain is worth it, as well as just for your own statistical purposes. There is little to no downside to using them, and the UTM parameters will dissappear from the URL as soon as the visitor clicks any link on your site.


  1. Download the Fallback Domain Redirect with UTM plugin folder from the main page.
  2. Upload the compressed folder named fallback-domain-redirect-w-UTM-master to the /user/plugins folder in your YOURLS installation.
  3. Extract the contents of the compressed folder. Rename the decompressed folder as Fallback-Domain-Redirect-w-UTM-Plugin (remove -master from the end). Finally you can delete the initial compressed folder.
  4. Move the index.html file to the root directory of your domain, if you also want the homepage to redirect.
  5. Go to the Plugins administration page ( eg.: http://sho.rt/admin/plugins.php ) and activate the plugin.
  6. Go to the Plugin's settings page and configure it. At minimum, selecting a fallback domain is required for the plugin to function. Selecting UTM parameters is completely optional and unrequired.
  7. Start using it and get on with your life.


  1. This plugin was built on YOURLS v1.7.2.
  2. This plugin will work best with PHP 5.4 or greater.
  3. This plugin requires YOURLS to be installed in the domain root. As opposed to in a subfolder like /YOURLS/.

For more info

For additional details on this plugin, as well as a detailed FAQ, please check the plugin Wiki. It always sucks to have to install a plugin or program just to find out if it does what you want it to. There you'll see all the gritty details, to better understand if this plugin is right for you.


MIT License - In other words, do whatever you want with it. Just don't try to hold me accountable if you're unhappy with the results.

Found it useful?

Consider giving the program a 'star' up there at the top, as a well-appreciated hat tip my way. And if this really solved a problem for you, you can always donate a buck or two. I promise that 100% of the proceeds will go directly to the furtherment of my vice fund.

You can’t perform that action at this time.