0

Hi I am a web application in ROR and shortening url using bit.ly. whenever i create an url using bit.ly i could custom url like http://bit.ly/19Mk8Oj now i want to remove bit.ly and needs to add my own custom url like ferdy.ly/sdf2323 how to do that? when i Google about this and found the following url http://support.bitly.com/knowledgebase/articles/76741-how-do-i-set-up-a-custom-short-domain-. now i have a registered domain for this from http://libyanspider.com/m and need help to integrate the custom domain with my bitly account? and my application is a feedback engine wherein we are charging user for subscription so i choose business account and received a mail from bit.ly that per month i need to pay $1995.. is custom domain name in bit.ly will cost this much?

ferdy
  • 41
  • 9
  • what you want is a url shortener algorithm you can google that if it would help – bjhaid Jan 07 '14 at 20:35
  • you can email sales@bitly.com or api@bitly.com if you have questions about integrating and the cost. you can connect the custom domain to Bitly even with a free account – James Socol Jan 08 '14 at 00:30

1 Answers1

0

what you want is a url shortener algorithm.

Simple explanation with least efforts:

Have a table that you would store your URLs in for lookup, and the id should be auto-incremented(This is default with AR in Rails), convert the id to base 36 with ruby

6788999.to_s(36) #=> "41ifb" Then you can have a URL as:

foo.com/41ifb

When the request for the shortened URL hits the controller(which you can basically even use bare Routing for) convert the param to an integer:

"41ifb".to_i(36) #=> 6788999

This is a simple basic URL shortener service

bjhaid
  • 9,592
  • 2
  • 37
  • 47