URL Shortener如何工作? [英] How does a URL Shortener work?

查看:388
本文介绍了URL Shortener如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道URL Shortener的工作原理,例如他们如何从地址栏中提取文本并将其映射到正确的URL,然后重定向它.他们使用哪种编程语言?他们如何维护映射历史?它们如何确保缩短的URL的唯一性?一个外行人如何在不访问URL的情况下取消映射?

I wonder how a URL Shortener works, like how they extract the text from address bar and map it to correct URL, later redirect it. What programming language do they use? How do they maintain the history of the mapping? How do they ensure the uniqueness of the shortened url? How can a lay man unmap it without visiting the URL?

推荐答案

Wiki是您的朋友

基本上,名称较短的网站将用作占位符,例如bit.ly.

Basically, a website with a shorter name is used as a place holder, such as bit.ly.

然后,bit.ly生成一个供用户提供的密钥,该密钥是随机生成的,不再重复.使用35个字符选项和8个左右的值进行数学运算.那有很多可能的钥匙.如果url等于先前存在的密钥,我记得在某处读到它们也可以重用密钥.

Then, bit.ly generates a key for the user to provide, which is randomly generated to not repeat. With 35 character options and 8 or so values, do the math. That's a lot of possible keys. If a url is equal to a previously existing key, I remember reading somewhere that they reuse keys as well.

他们并没有真正使用特定的编程语言,只是使用了简单的URL重定向,我相信可以使用HTML来完成.

They don't really use a specific programming language, they just use a simple URL redirect, which can be done with HTML i believe.

这篇关于URL Shortener如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆