1. <legend id='CyhR7'><style id='CyhR7'><dir id='CyhR7'><q id='CyhR7'></q></dir></style></legend>
    2. <small id='CyhR7'></small><noframes id='CyhR7'>

      <tfoot id='CyhR7'></tfoot>
    3. <i id='CyhR7'><tr id='CyhR7'><dt id='CyhR7'><q id='CyhR7'><span id='CyhR7'><b id='CyhR7'><form id='CyhR7'><ins id='CyhR7'></ins><ul id='CyhR7'></ul><sub id='CyhR7'></sub></form><legend id='CyhR7'></legend><bdo id='CyhR7'><pre id='CyhR7'><center id='CyhR7'></center></pre></bdo></b><th id='CyhR7'></th></span></q></dt></tr></i><div id='CyhR7'><tfoot id='CyhR7'></tfoot><dl id='CyhR7'><fieldset id='CyhR7'></fieldset></dl></div>
        <bdo id='CyhR7'></bdo><ul id='CyhR7'></ul>

        URL缩短站点

        URL Shortening Site(URL缩短站点)

          <tfoot id='ojGOn'></tfoot>
            <legend id='ojGOn'><style id='ojGOn'><dir id='ojGOn'><q id='ojGOn'></q></dir></style></legend>

                <bdo id='ojGOn'></bdo><ul id='ojGOn'></ul>

                  <tbody id='ojGOn'></tbody>

                  <small id='ojGOn'></small><noframes id='ojGOn'>

                  <i id='ojGOn'><tr id='ojGOn'><dt id='ojGOn'><q id='ojGOn'><span id='ojGOn'><b id='ojGOn'><form id='ojGOn'><ins id='ojGOn'></ins><ul id='ojGOn'></ul><sub id='ojGOn'></sub></form><legend id='ojGOn'></legend><bdo id='ojGOn'><pre id='ojGOn'><center id='ojGOn'></center></pre></bdo></b><th id='ojGOn'></th></span></q></dt></tr></i><div id='ojGOn'><tfoot id='ojGOn'></tfoot><dl id='ojGOn'><fieldset id='ojGOn'></fieldset></dl></div>

                  本文介绍了URL缩短站点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在开发一个使用 PHP、MySQL 和 Apache 的 URL 缩短站点.当我查看开源项目时,URL 缩短的总体思路:用户提供一个 URL 链接,系统从数据库中获取该链接的 ID.然后转换 ID X 基本系统(我使用的是 base 36).然后使用 Apache mod_rewrite 并创建缩短的 URL,然后重定向.是否所有的 URL 缩短站点都像这样工作,或者是否有一些使用除此之外的不同算法?有什么想法可以与其他 URL 缩短系统不同吗?

                  I am working on a URL shortening site which uses PHP, MySQL and Apache. General idea of URL shortening as I look at open source projects: user gives a URL link and the system gets ID for that link from database. Then convert the ID X base system (I am using base 36). Then use Apache mod_rewrite and create shortened URL and then redirect. Do all of the URL shortening sites work like that or do some use a different algorithm other than this? And any idea for making a difference from other URL shortening systems?

                  推荐答案

                  我认为你说的很对.

                  不过,我不会像你说的那样做的一件事是关于这部分:

                  One thing I would not do like you said, though, is about this part :

                  然后使用 apache mod_rewrite 并创建缩短网址,然后重定向.

                  then use apache mod_rewrite and create shorten url and then redirect.

                  我认为我不会创建 Apache RewriteRule,也不会使用 mod_rewrite.

                  I don't think I'd create an Apache RewriteRule, nor use mod_rewrite.


                  当收到一个短网址时,比如 short.com/MYID,Id 会:

                  • 将MYID"部分解密为DB中的id号
                  • 从数据库中获取 URL
                  • 只需从某些服务器代码(如 PHP,使用 header 函数)

                  我猜有点像这样:

                  // fetch $urlFull from DB (corresponding to the MYID received in GET)
                  header('HTTP/1.x 301 Moved Permanently');
                  header('Location: ' . $urlFull);
                  die;
                  


                  (编辑)如果 mod_rewrite 你的意思是transform short.com/MYID to short.com/id=MYID",哦,是的,在这种情况下,当然!


                  (edit) If by mod_rewrite you meant "transform short.com/MYID to short.com/id=MYID", oh, yes, in this case, of course !

                  顺便说一句,我在我的一个网站上使用了这样的东西:

                  I'm using something like this on one of my sites, btw :

                  RewriteEngine on
                  RewriteCond %{REQUEST_URI}  !^/index.php
                  RewriteRule ^(.*)$ /index.php?hash=$1   [L]
                  


                  希望这会有所帮助:-)


                  Hope this helps :-)

                  这篇关于URL缩短站点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                      <bdo id='Lwzcd'></bdo><ul id='Lwzcd'></ul>
                      <tfoot id='Lwzcd'></tfoot>
                      1. <legend id='Lwzcd'><style id='Lwzcd'><dir id='Lwzcd'><q id='Lwzcd'></q></dir></style></legend>
                            <tbody id='Lwzcd'></tbody>

                          <small id='Lwzcd'></small><noframes id='Lwzcd'>

                          <i id='Lwzcd'><tr id='Lwzcd'><dt id='Lwzcd'><q id='Lwzcd'><span id='Lwzcd'><b id='Lwzcd'><form id='Lwzcd'><ins id='Lwzcd'></ins><ul id='Lwzcd'></ul><sub id='Lwzcd'></sub></form><legend id='Lwzcd'></legend><bdo id='Lwzcd'><pre id='Lwzcd'><center id='Lwzcd'></center></pre></bdo></b><th id='Lwzcd'></th></span></q></dt></tr></i><div id='Lwzcd'><tfoot id='Lwzcd'></tfoot><dl id='Lwzcd'><fieldset id='Lwzcd'></fieldset></dl></div>