Setting up a custom URL shortening service using Bitly.Pro

This content is 14 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

If, like me, you’ve been reading the stories about Libya taking back control of certain .ly addresses, then you might be thinking “what about all those short URLs I’ve been sharing?”. For those who haven’t read the story, the Libyan authorities have been reclaiming addresses from sites whose content breaches Sharia law.  Bit.ly, the American-based link shortener that’s become very popular since the demise of tr.im doesn’t think it’s at risk, even though some of the content it signposts might offend those of a Muslim faith, because: it doesn’t actually host the content; and bit.ly addresses are also accessible using the slightly longer bitly.com URL (for example, resolves to the same address as bitly.com/markwilsonit).

Even so, I decided to implement my own custom domain for link shortening – one that I have control over.

I decided to stick with a top level domain from a country that’s not likely to take back the address and, even though Italy (.it) is a slight risk to me as I don’t live/work there, .it domains are officially available to anyone who resides within one of the European Union member states (and that includes the UK), giving me some legitimate claim to the domain at least. Unfortunately, I found that I couldn’t register any 2 or 3 character domains, but Matt Marlor suggested I go for mwil.it and, yesterday, I successfully registered that domain.

Incidentally, if you’re looking for a short domain name, DomainR is a website that will work through various permutations of your name/company name and flag those that are valid/available.

Grabbing the domain is only the first step though – I also needed a link shortening service. I could have implemented my own (indeed, I may still do so) but decided to use the service instead, thinking that I can still migrate the links at a later date, should that become necessary.

One of my friends, Alex Coles, asked why I selected the Bitly.Pro route rather than using a script like YoURLs and, aside from the fact that would be something else for me to manage on my webspace, the Bit.ly API is widely supported by many of the other services that I use – like TwitterFeed, and TweetDeck – reducing the effort involved in generating new short links.

At the time of writing, Bitly.Pro is still in beta but I completed the form to apply to join and, shortly afterwards, received an e-mail to say I was in. At that time I hadn’t registered my domain but, once that was done, it was a simple case of:

  • Creating a DNS A record (actually, I created two – one for * and one for @) on the short domain (mwil.it) to point to Bit.ly’s servers (168.143.174.97).
  • Adding a DNS CNAME record (3bae9d57b0bf.markwilson.co.uk. CNAME cname.bit.ly) to my tracking domain (markwilson.co.uk) to prove ownership (other options included uploading a file or adding some metadata to the site).
  • Waiting for DNS propagation (which didn’t take long for me but may have been up to 24 hours) and verifying the details in my Bitly.Pro account settings.

With these steps completed, I had everything in place to start generating short URLs using Bitly.Pro, but the was one more step for my client applications – TwitterFeed and TweetDeck both needed to be provided with an API key in order to use the Bit.ly API with my account (TweetDeck even gives the link to go and get the key). After entering those details, I sent a test tweet and was pleased to see it using the mwil.it domain, with no additional work required on my part.

So, what’s left to do? Well, I still don’t know why sites like the New York Times and TechCrunch get custom URLs when I link to them, even without an API key (I suspect for that I would need an Enterprise account) and it may still be prudent to keep an offline copy of my short-long URL mappings, just in case Bit.ly should ever cease to exist. There are also some client applications that don’t use my custom shortener (for example, Twitter’s own app for the iPad uses another Bit.ly domain, j.mp, and doesn’t appear to have any options to enter an API key) but at least my auto-posted tweets (i.e. links to my blog posts, etc.) now use a domain that’s under my control.

The search engine friendly way to merge domains

This content is 17 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

In common with many website owners, I have multiple domain names pointing at a single website (markwilson.co.uk, markwilson.me.uk and markwilson.it). There’s nothing wrong with that (it’s often used to present localised content or to protect a trademark) but certain search engines will penalise sites where it appears that multiple URLs are being used to present duplicate content (hence increasing the link count and inflating the position within the index).

The trick is to ensure that the domains are merged in a manner which is acceptable to the major search engines. It’s generally accepted that the way to do this is to choose the primary domain name (in my case, that’s markwilson.co.uk) and to rewrite any requests received by the web server(s) on any secondary domain names so that they are redirected to the primary domain name (using HTTP status code 301 – moved permanently).

For a site running on an Apache web server with the mod_rewrite module compiled, this is achieved using some directives in the .htaccess file. A description of the required code can be found in various locations, including Brian V Bonini’s 301 permanent redirect article but my site uses some code from a recent .net magazine article to combine the domain name rewrite with the placement of any missing www prefix:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^primarydomain\.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^(www\.)?secondarydomain\.com$ [NC]
RewriteRule ^(.*)$ http://www.primarydomain.com/$1 [R=301,L]

After making the changes, it’s important to check the server headers (e.g. using the SEO Consultants check server headers tool) and ensure that the server is correctly returning an HTTP status code 301 that redirects to the primary domain name, hopefully resulting in an eventual HTTP status code 200 – OK:

#1 Server Response: http://www.secondarydomain.com/
HTTP Status Code: HTTP/1.1 301 Moved Permanently
Date: Tue, 27 Feb 2007 15:19:42 GMT
Server: serverdetails
Location: http://www.primarydomain.com/
Connection: close
Content-Type: text/html; charset=iso-8859-1
Redirect Target: http://www.primarydomain.com/

#2 Server Response: http://www.primarydomain.com/
HTTP Status Code: HTTP/1.1 200 OK
Date: Tue, 27 Feb 2007 15:19:44 GMT
Server: serverdetails
Connection: close
Content-Type: text/html

Oops! Dropped off the ‘net for a while…

This content is 17 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

No sooner had I blogged about the smooth transfer of my domain name to a new registration agent when my website dropped off the ‘net for a day or so. I had naively thought that, if I left the domain using the old name servers for a while, everything would work as it had done previously until I was ready to launch the new site – I hadn’t reckoned on my old hosting provider removing their DNS entries for the domain, leaving all my visitors with HTTP status code 404 – not found.

As soon as I noticed, I uploaded the old site to my new server and updated the name server records for the domain but, for the time it took to propagate that update, www.markwilson.co.uk was effectively offline.

Sorry. My mistake.

Simple UK domain name transfers

This content is 17 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

I’ve been the legal registrant of the markwilson.co.uk domain for almost 8 years now and it’s the domain name that drives most of the traffic to this website. Consequently, I would be very upset if I was to lose it and I’ve never been confident enough to move it away from the ISP whom I first registered the domain through (PlusNet/Force 9). Even though I have an ADSL line on a separate account, I have kept a dial-up account open with them for many years, just to maintain the webspace and domain name. In recent months, however, I’ve been getting close to the bandwidth limit on that service and they have been pretty poor at responding to my queries about what will happen once my traffic gets too much (I even offered to pay more money). Support from PlusNet/Force 9 has always been variable (excellent or poor – nothing in between) so I decided that it’s time to move on and my friends at ascomi are able to provide me with a very reasonably-priced hosting service with plenty of headroom.

So, it was with some trepidation that, this afternoon, I finally changed the IPS tag from FORCE9 to FASTHOSTS and transferred the domain name to my account at UKReg. That was it. Easy. Once the transfer had taken place, I could update the DNS server details to point anywhere I like (although at the moment they are still pointing exactly where they always have been, just until I get the new website up and running on my server at ascomi).

I was amazed at how efficient the process was – so much so that I raised a paranoid support call with UKreg, just to make sure that they will re-register my domain when it comes up for renewal.

I appreciate that for many people this is a very simple process and why does it justify a blog post? Well, it was a very big deal for me and I’ve been putting it off for years (literally). I just wanted to be sure that anyone who has similar issues and who stumbles across my ramblings can have their concerns laid to rest.

Further information on UK domain name transfers can be found at Nominet.

New domain name – markwilson.it

This content is 18 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

A few weeks back, I registered a new domain name for this blog, along with my other IT-related activities. markwilson.co.uk will still remain in place (and will be the primary domain name, so as to preserve my Google PageRank) but over a period of time (as some page re-writes will be required) the IT-related content will also be made available at markwilson.it.

The .it top level domain is intended for Italian sites but as, in English, IT is also an abbreviation for information technology, it makes sense to register it for my IT-related activities.

EuroDNS
It’s the first time that I’ve used the EuroDNS domain name registration service and I’m pleased to say that the process was extremely smooth (despite La Naming Authority Italiana‘s insistence on the use of a written contract, which delayed things for a while). EuroDNS were able to send me the contract electronically (together with an English translation) and I was able to send the signed copy back in electronic form too. Something else I found (which is extremely important as domain name registrars are generally notorious for poor support) was that, after the application had gone into a black hole at La Naming Authority Italiana, EuroDNS were helpful and responded to my e-mails to get things moving again.

Is someone trying to hijack my domain?

This content is 18 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

As you are reading this blog, you can see that I own the markwilson.co.uk domain. I also own markwilson.me.uk (even though the address details are out of date) but evidently someone out there thinks that they do and it’s getting kind of frustrating because I’m getting e-mails from people trying to get in touch with someone who is obviously giving out their address using my domain name!

So far I’ve had a quote for web design services (or is that a hint?!) and information about some conference (initially a declined credit card and then details for joining the event).

Because I try to be a good ‘net citizen, I advise people that they are using the wrong e-mail address (and most will update their records, or pick up the phone and call the guy – I can’t because I don’t have his details) but this is getting annoying now… could this be a bizarre method of generating spam in my mailbox?

If you think your e-mail address ends with @markwilson.me.uk, then I’m sorry but it doesn’t! Likewise if you’ve paid someone for that domain name, you’ve been a victim of fraud…