IntroductionI am working on a promotion system recently, and I would like to share the problem of long and short links involved in it. The promotion method is mainly to send greetings to customers via SMS and push promotional links (not advertisements), but the links are really too long. Not to mention the problem of SMS being charged by word count, I just want to delete them immediately after seeing them. So the organization arranged to study how to make the links shorter and more concise. . . About long and short links
Long and short link principle
Note: Short links can redirect to long links using 301 (permanent redirection) or 302 (temporary redirection). The difference lies in the management of resources. 301 will permanently remove the old resources and replace them with redirected new resources; while 302 will still retain the old resources, but only redirect them to the new resources. No replacement will occur and the new resources will not be saved. Demo Case
Webmaster's Home: https://tool.chinaz.com/tools/dwz.aspx, you need to register to use it. After all, it's free, so you still have to respect it~~ Short URL: https://www.dwz.lc/, which provides very complete functions such as setting validity period and access password, and is easy to use
First, there is the algorithm tool class for generating short link codes. The algorithm is not fixed, and you can use other algorithms to generate according to your own habits or work requirements. The most important thing is to ensure the uniqueness of the short link code. Then there is the relationship mapping for maintaining short links. Here, the editor uses a collection variable. It is recommended to use a database such as MySQL to persist the relationship data to avoid data loss and access failure. /** Simulation operation process: Start the short link service locally, then start a business service as a long link service, generate a short link from the long link, then access the short link and successfully jump to the long link address. Demonstration results SummarizeThe above is all the content shared in this article. Of course, there is more than one way to implement it. Friends who have ideas can send private messages to discuss. |
<<: Report: Global 5G mobile data traffic is growing explosively
"As a network engineer, what does it take to...
spinservers is a site under Majestic Hosting Solu...
The unit price of traffic has dropped from 15 yua...
Judging from the current situation, 5.5G technolo...
The tribe mainly shares cheap VPS hosts. Although...
After entering the URL in the browser, it will pe...
Currently, 5G has become a hot topic in the indus...
Ask any IoT vendor what makes their product excit...
Http protocol is easy to use for programmers with...
September 16, 2019 WiFi Alliance announces WiFi6 ...
[51CTO.com original article] In the Internet era,...
background With the rapid development of the Inte...
On May 18, Lenovo and Intel jointly demonstrated ...
Tribe shared the news about Olink.Cloud in Novemb...
The future of cloud is bright. By 2024, more than...