Hi,
Tiny URL's are very popular when it comes to shortening a web URL. There are many third party tools such as bit.ly, tinyurl.com etc. But if you want to do it yourself, then you will find the entire source code and the logic of how it works in this post.
For this you need to keep in mind the following:
1. Providing an interface to the user to enter any URL and on submitting it a short URL is generated. The domain of the short URL will be in your server.
e.g.
if your website name is http://tiny.url, then the tiny urls should look something like, http://tiny.url/#####. Where "#####" is a tinyword which represent the actual URL which the user has entered.
2. You need to convert the above http://tiny.url/##### into its corresponding URL and redirect the page to there.
In my case instead of http://tiny.url/##### I will be using http://localhost/php/tinyurl/######, since I am running from my localhost. So lets start with the development.
Code and Explanation:
Tiny URL's are very popular when it comes to shortening a web URL. There are many third party tools such as bit.ly, tinyurl.com etc. But if you want to do it yourself, then you will find the entire source code and the logic of how it works in this post.
For this you need to keep in mind the following:
1. Providing an interface to the user to enter any URL and on submitting it a short URL is generated. The domain of the short URL will be in your server.
e.g.
if your website name is http://tiny.url, then the tiny urls should look something like, http://tiny.url/#####. Where "#####" is a tinyword which represent the actual URL which the user has entered.
2. You need to convert the above http://tiny.url/##### into its corresponding URL and redirect the page to there.
In my case instead of http://tiny.url/##### I will be using http://localhost/php/tinyurl/######, since I am running from my localhost. So lets start with the development.
Code and Explanation:
