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
[51CTO.com Beijing report] In order to implement ...
DiyVM is a long-established Chinese hosting compa...
Introduction Simple is beautiful. In the world of...
10gbiz sent a blog reader exclusive discount code...
The Green Grid, a non-profit organization dedicat...
Recently, the National Intellectual Property Admi...
[[189173]] If the 4G network is a knife that can ...
In the previous article, we learned about the fiv...
Labs Guide With the development of mobile communi...
[51CTO.com original article] On August 8, at the ...
On June 6, 2019, the Ministry of Industry and the...
UFOVPS has released the biggest discount this yea...
Currently, nearly 100 operators around the world ...
[[409633]] This article is reprinted from the WeC...