Explorer and Engineer

Bitly Custom Short Domain Tweak with Cloudflare

2 September 2012 in essay

Background

Bitly recently made their custom short domain a free feature - so you can set up any domain less than 14 characters in length as a shortening domain. This elevates professionalism on Twitter and other digital platforms because links can now be branded.

I bought pithomas.com for use as a short domain, and have been using it for months. However, based on the DNS-level changes needed to use a custom Bitly domain, I cannot control where the base domain goes - navigating directly pithomas.com would redirect to bitly.com, not philipithomas.com. This made it difficult to associate the branded short domain with the main website.

I found a free solution to this problem using Cloudflare Page Rules. Because the page rules run at the DNS level, they can override bitly forwarding patterns.

Tweak

For: Redirect the base domain of a Bitly short domain to a different website than bitly.com

Prerequisite The domain's DNS must be on Cloudflare (Note: their free tier suffices for this tweak)

Setup

Example shown: redirecting the short domain pithomas.com to philipithomas.com

  1. On the DNS page, make sure that Cloudflare services are active on the domain
  2. Example: On the A record of pithomas.com, the orange Cloudflare Services toggle is "on"
  3. Create a new page rule on the domain
  4. In the URL Pattern field, input the root domain
  5. Example: pithomas.com

    Note: "http://" is optional - without it, the page rule technically matches https too
  6. Turn on the "Forwarding" button
  7. In the destination url, enter the website you want as the landing site instead of bitly.com.
  8. Example: http://philipithomas.com.

    Note: The protocol (e.g. "http://") must be included
  9. Optional: Purge the Cloudflare page cache under "Cloudflare Settings" for the domain.