Bitly Custom Short Domain Tweak with Cloudflare
2 September 2012
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
- On the DNS page, make sure that Cloudflare services are active on the domain Example: On the A record of pithomas.com, the orange Cloudflare Services toggle is "on"
- Create a new page rule on the domain
- In the URL Pattern field, input the root domain Example: pithomas.com
- Turn on the "Forwarding" button
- In the destination url, enter the website you want as the landing site instead of bitly.com. Example: http://philipithomas.com.
- Optional: Purge the Cloudflare page cache under "Cloudflare Settings" for the domain.
Note: "http://" is optional - without it, the page rule technically matches https too
Note: The protocol (e.g. "http://") must be included