Chalist
Chalist

Reputation: 3307

How do url shorting sites work?

How do URL shorting sites like bit.ly or goo.gl work? Does anyone know what technique or algorithm they use?

Upvotes: 1

Views: 310

Answers (1)

Shoban
Shoban

Reputation: 23016

Save the URL and generate unique key for the URL and store it in the DB. Use this key to navigate to the URL.

Do you need complex algorithm for this? :-)

If you want to make it complex.

  1. Check for malicious URLs and block them
  2. Have stats based on number of clicks
  3. Have registrations and users have their own small urls
  4. Develop plugins for browsers to generate short urls

etc etc

Upvotes: 5

Related Questions