Short URL, as the name suggests, shortens the URL. The commonly used server-side code shifts, and today in Web 2.0, I have to say that this is a trend. There are already many similar services. With the shortened URL, you can replace the original long URL with a short URL, making it easier for users to share links.
Short URL Recovery
As long as you can access the Internet, you can find a website that provides URL shortening services, and then follow the corresponding instructions on the website. The general operation is to directly enter the corresponding long URL in the designated input box of the website that provides the URL shortening service.
Short URLs usually use "less-character URLs" + "/" + "Code". Opening short URL pages usually jumps directly to the URL you want to shorten (common), or jumps after a few seconds of advertising.
As long as you can access the Internet, you can find one, and then follow the corresponding prompts on the website. The general operation is to submit your long URL directly in the designated input box of the forwarding station.
Algorithm principle edit
Short-site websites basically implement URL shortening by turning to ASP or PHP.
1) Generate a 32-bit signature string from the long URL md5, divided into 4 segments, each segment is 8 bytes;
2) For these four segments of loop processing, take 8 bytes, and treat it as a hexadecimal string and 0x3fffffff (30 bits 1) AND operation, that is, ignore processing of more than 30 bits;
3) The 30 digits are divided into 6 segments, and each 5 digit number is used as the index of the alphabet to obtain a specific character, which is sequentially performed to obtain a 6 digit string;
4) The total md5 string can get 4 6-bit strings; any one of them can be used as the short URL address of this long URL;
a-zA-Z0-9 The 62-bit combination of 6 bits can generate more than 50 billion combinations. By mapping certain numbers and characters, a unique string can be generated. For example, the 62nd combination is aaaaa9, The 63rd combination is aaaaba, and then the shuffle algorithm is used to scramble the original string and save it, then the combination string at the corresponding position will be an unordered combination.
Store the long URL in the database, take the returned id, and find the corresponding string. For example, if the returned ID is 1, then the corresponding string combination is bbb. When the ID is 2, the string combination is bba, and so on. Until the 64 combinations are reached, the possibility of duplication will not appear, so if you use the above 62 characters and randomly select 6 characters to combine into a string, your data inventory will not be duplicated until it reaches more than 50 billion.
API interface editing
There are no special commands, different URL shortening providers will be different, so you can use it to your own website.
Of course, some websites do not have an API.
There are no special commands, different short URL providers will have different APIs, so you can take advantage of your own website.
Custom dropout edit
Most URL shortening programs are included. Short URLs usually use "less-character URLs" + "/" + "code", so the code part can be customized.
Short URL recovery edit
Most URL shortening programs come with a URL that can be restored directly to a real URL.
Shorten the URL for easy dissemination, suitable for publishing platforms with word limit such as Weibo. In today's society, the number of words can never limit the length of our URL!
Top Blog Posts
- Top 9 best choices for Google URL Shortener 1 years ago
- URL shortener's Bookmarklet setting method 1 years ago
- What is a short URL? 1 years ago
- Introduction to all features of the SuoRt.com URL Shortening Tool 1 years ago
- Why should you use an URL shortener? 1 years ago