Redirect root domain of custom short URLs using bit.ly pro


Update: Bitly Pro is now just Bitly

We recently used bit.ly pro to implement custom short urls for 511contracosta.org – with 511cc.org. Its currently a free service and works the same as bit.ly shortened URLs, only with a custom domain name of your choosing. Amazon just announced yesterday that they are using bit.ly pro for custom URLs using amzn.to.

Things worked great, and it was easy to set up the custom url with bit.ly pro by changing the A record for the domain name, however this meant that anyone going to 511cc.org directly with no hash on the end would be redirected to bit.ly’s main page. We needed this to redirect to a URL of our choosing, in this case 511contracosta.org. This isn’t an option in bit.ly pro, according to their FAQ its only available for bitly.Pro Enterprise users which costs $995/month. This was way beyond our price range.

Fortunately, its pretty easy to use .htaccess to carry out this.

  • First, you need to set up the short domain name to use namesevers that point to a hosting account you control. For us, this was Media Temple so we set nameservers to ns1.mediatemple.net and ns2.mediatemple.net.
  • Next, add a file called .htaccess
  • The contents of the .htaccess file should be:


  • You should replace “http://511contracosta.org” with the domain name you’d like to redirect the root to
  • Enjoy bit.ly pro, with at least one feature of bitly.pro enterprise

18 thoughts on “Redirect root domain of custom short URLs using bit.ly pro

  1. Pingback: Introducting Hu.la – our new URL shortener | The Adventures of Chris Schultz
    1. Glad this worked for you. We've now switched away from using bitly pro to a self-hosted implementation of YOURLS http://yourls.org/ – a php script that offers the same features as bit.ly pro but doesn't share the namespace. This means we can use anything for the trailing characters – like http://511cc.org/bike and not have to worry about conflicting with another bit.ly user. Its very easy to set up and offers statistics and other customization options.
      http://yourls.org/

  2. I came across your blog post while I was searching for bitly’s “root domain redirect” feature. Glad I found about YOURLS. I’ll give it a try too! Thank you for sharing the tips!

  3. This is awesome, I implemented it a while ago on http://cjgw.in and it works brilliantly.

    However, I really wanted to have custom short URLs and didn’t want to use YOURLs because it’s a bit of a hassle (compared to using bit.ly), and because there are so many plugins available that work directly with bit.ly which made this even easier to use (since bit.ly automatically returns your custom URL to the plugins).

    Instead, I figured out a way of creating your custom short URLs in the .htaccess file! I’ll blog a tutorial and refer to this post since it was here that I got the initial knowledge, but all you have to do is add the following line before the rest of the RewriteRules:

    RewriteRule ^CustomShortURL$ BitlyShortURL [L]

    Note that this will also work going DIRECTLY to your resultant URL, rather than via bit.ly:

    RewriteRule ^CustomShortURL$ http://end.website.com [L]

    For example, I have http://cjgw.in/quiz setup to go to http://bit.ly/nzutFQ, which I like because I get all of bitly’s reporting features. That looks like this:

    RewriteRule ^quiz$ nzutFQ [L]

    If I wanted to, I could send http://cjgw.in/quiz directly to my blog post.

    Hopefully, this will be useful to anyone who wants to use whatever short URL they want, and change at as and when they see fit 🙂

    P.S. If anyone fancies taking that quiz (http://cjgw.in/quiz), I’d REALLY appreciate it because it’s part of my master’s dissertation on Digital Literacy.

  4. Since I’m not seeing the result expected, I jsut want to make sure I’m doing it right:

    1. I created a file in notepad name only .htaccess, that had only the above 3 code lines.

    2. I uploaded the file to my host to the following folder: /x/dta

    3. I configured in my host 1and1 the domain to the following destination: /x/dta

    Still nothing happened.

    For the record, I deleted the Bitly html file and changed the A-record IP address back to 1and1. Neither of the changes stopped my custom shorted urls from working.

    Help, anyone?

    1. These instructions may not work on all hosts – make sure your host supports using .htaccess files and that you place it in the web root directory.

  5. Just an update for new readers. Bity might send you a similar email.

    —Message—
    You configured a custom short domain (411ny.org) with bitly on October 25 2011. We have detected a configuration problem in the DNS for 411ny.org. Please visit bitly for information on how to update your DNS settings.
    —Message—

  6. Hi, I know this hasn’t been comment on in 5 years, but hoping to see if there is a current solution for this same issue.

Leave a Reply

Your email address will not be published. Required fields are marked *