When you enter a long URL into our web site, a number of things happen.
1) First things first, we check what you've entered into our site. We're looking for things like bad characters (you can't have certain characters in a URL) and overly-long URLs.
2) We then look at the long URL you've entered and make sure it hasn't already been shortened by a different URL shortening web site. This is for anti-spam reasons - spammers can create chains of shortened URLs in a bid to cover their tracks. You can't shorten a URL that has already been shortened.
3) With those two checks out of the way, we then look at your long URL again and make sure it's not blacklisted. Another anti-spam measure, we make sure the destination of the URL isn't on a spammers blacklist. This is one of the reasons we had to prevent ALL links to '.cn' sites too.
4) We then look for your long URL in our database to see if it already exists. It's quite possible that someone has already shortened your long URL in the past so if they have, we present you with the already-shortened URL. We do this for a couple of reasons, the main one is to keep our URLs short - after all, there is no point in us storing two (or more) of the same long URL, it wastes space in the database and will only aid in making your short URL one character longer...
5) Once we've checked to make sure your long URL doesn't already exist, we then look to see if you've requested a custom URL. If you have, we check to make sure the custom shortened URL doesn't already exist. We also check your requested custom URL to make sure you've requested 'legal' characters and that your custom URL is less than 10 characters long (it wouldn't be a short URL otherwise!)
6) With the pre-existance checks all done, we then set about shortening your long URL.
To do this, we store your long URL in our database. We then look up the next available short URL using a custom-made 'sequential alphanumeric generator'. Our sequential alphanumeric generator (shame we can't patent it!) will then calculate the shortest possible URL for you and save that in the database too, along side your long URL.
All this might seem a bit long winded, but this entire process takes place in 0.0004 seconds (which is pretty quick) so you are never kept waiting while we work out the shortest URL for you!
A bit more information about our sequential alphanumeric generator for you...
The sequential alphanumeric generator works by offering you a combination of possible alphanumeric codes. These are 'number', 'lower case letter', 'upper case letter'. Some URL shortening services are case-sensitive, which in our opinion is a bad thing as this dramatically reduces the amount of short URLs available for use.
Our sequential alphanumeric generator is case sensitive. This means that a short URL of http://fwd4.me/c is different from http://fwd4.me/C
Using a combination of numbers, lower case letters and upper case letters means we can offer you a lot more short URLs, with the following availability:
- 1 Character Short = 62 combinations available
- 2 Characters Short = 3,844 combinations available
- 3 Characters Short = 238,328 combinations available
- 4 Characters Short = 14,776,336 combinations available
- 5 Characters Short = 916,132,336 combinations available
When someone clicks on your short URL, we look it up in our database and fetch the corresponding long URL. Using a bit of magic, we then strictly follow the RFC specifications for client redirection and present the users browser with a 'HTTP 301 Moved Permanently' message. This informs the users browser that the page they are seeking is no longer here (at the short URL address) and that it has permanently moved to the long URL - and off they go!
The reason we use HTTP 301 Moved Permanently redirection is two-fold. Number one, because it's 'clean', it works with everything (all internet browsers, xml applications, etc) and number two, because it maintains Search Engine Optimisation (SEO) for the long URL in question (which keeps search engines and web masters happy too).
Hopefully all this makes sense...
Any questions? Just ask using the box below!


5 comments: