How to prevent url shorteners from damaging your online reputation

Since I'm posting on social media I also used URL shortener services, in my case Bitly. Using an URL shortener service can make long URL's like, a whopping 76 characters but good for SEO, into a short url like, 22 characters. The shorter URL leaves more characters in your social media post like Twitter.

The problem is that services like Bitly, Google and TinyUrl can block visitors from visiting your website since they are in the middle. And that's exactly what happened to us.
Creating short URL's using Bitly they look OK from the online interface but when opening the link Bitly shows a clear do not go there! page like this.

Bitly warning and stop page blocking access to your website

In short, anyone that sees this page is leaving very fast, while your business just got a bad reputation because some service decided blind to blacklist it.
Note that in my case is was not re-using links, I did not edit links and I'm spamming nor providing malware.

At first I was OK, let's contact Bitly support and ask them to explain why this is happening and ask them to whitelist the target domain. Until now I'm still waiting for them to reply to both of my requests.
I'm using the free service and the FAQ explains that free service users don't get support. End of story...

All this got me thinking, what if I would run my own URL shortener service? It can't be that difficult based on Apache web server and mod_rewrite.
Let's do this! Start Google and searching for "run your own url shortener" the first result was spot on!

Running your own url shortner using Yourls

What is YOURLS

YOURLS stands for Your Own URL Shortener. It is a small set of PHP scripts that will allow you to run your own URL shortening service (a la TinyURL or Bitly).

Running your own URL shortener is fun, geeky and useful: you own your data and don't depend on third-party services. It's also a great way to add branding to your short URLs, instead of using the same public URL shortener everyone uses.

YOURLS Features

  • Free and open-source software.
  • Private (your links only) or Public (everybody can create short links, fine for an intranet)
  • Sequential or custom URL keywords
  • Handy bookmarklets to easily shorten and share links
  • Awesome stats: historical click reports, referrers tracking, visitors geo-location
  • Neat Ajaxed interface
  • Terrific Plugin architecture to easily implement new features
  • Cool developer API
  • Full jsonp support
  • Friendly installer
  • Sample files to create your own public interface and more

YOURLS admin dashboard

What else?! Right? Let's do this!

All you need is:

  1. a short domain name
  2. webserver with a virtual host
  3. the YOURLS source code

In my case I wanted the short domain to be somekind related to the oneICT brand and since most of theses links are informational like For Your Information was registered via NameCheap.

Using the NameCheap control panel I pointed the nameservers to my webserver. Since the webserver is using Virtualmin adding the virtual host is very easy, providing the webpage, L'ets Encrypt SSL certificate and Maria/MySQL database.

Now all that remains is downloading the YOURLS source code to the webserver and configure user/config.php from a copy of user/config-sample.php.

After this you can visit your-short-url/admin to finish the setup and you are ready to start shortening your url's.

How cool is this?! I can even edit a short url and see the visitors in graphs and maps.

YOURLS statistics

Once again, the open source world provided just what I needed, giving me full control of my communication.

Thanks  to  @yourls, @ozh (lead developer) for providing this great solution.