如何使用 mod_rewrite 隐藏重定向的 URL

发布于 2024-09-04 06:15:44 字数 1729 浏览 2 评论 0原文

有没有办法隐藏重定向的网址,这就是我的想法:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*)$ http://minteddomain.com/mint/pepper/tillkruess/downloads/tracker.php?url=http://%{HTTP_HOST}%{REQUEST_URI}&force

所以长重定向的网址 http://minteddomain.com/mint/pepper/tillkruess/downloads/tracker.php?url=http://%{HTTP_HOST}%{REQUEST_URI} 到某个内容更短,如 /mintedomain.com/track/

有可能吗?

Adrian

编辑:

Andrew:

这是一个带有文件下载跟踪器插件的统计软件 Mint (haveamint.com)。文件下载跟踪器的工作方式如下:

在 .htaccess 中,每个文件(zip、rar、txt...)都被重定向到 tracker.php 文件(因为统计信息): http://mydomain.com/mint/ pepper/tillkruess/downloads/tracker.php?url=http://%{HTTP_HOST}%{REQUEST_URI}

因此,对于 zip 文件,重定向的 url 如下所示: http://minteddomain.com/mint/pepper/tillkruess/ downloads/tracker.php?url=http://mydomain/downloads/apple.zip

这个重定向的 URL 非常长而且难看。对我来说最好的方法是将这个重定向的 URL 重定向到更短的 URL:例如: http:// mydomain.com/track/downloads/apple.zip..

所以 http://mydomain.com/track 将是 http://minteddomain.com/mint/pepper /tillkruess/downloads/tracker.php

is there any way to hide redirected url, here is what I think:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*)$ http://minteddomain.com/mint/pepper/tillkruess/downloads/tracker.php?url=http://%{HTTP_HOST}%{REQUEST_URI}&force

So the long redirected url http://minteddomain.com/mint/pepper/tillkruess/downloads/tracker.php?url=http://%{HTTP_HOST}%{REQUEST_URI} to something shorter like /mintedomain.com/track/

It is possible?

Adrian

edit:

Andrew:

This is a stats software Mint (haveamint.com) with File Download tracker plugin. The File Download tracker works in this way:

in .htaccess every file (zip, rar, txt,...) is redirected to the tracker.php file (because the stats):
http://mydomain.com/mint/pepper/tillkruess/downloads/tracker.php?url=http://%{HTTP_HOST}%{REQUEST_URI}

So the redirected url look like this for a zip file: http://minteddomain.com/mint/pepper/tillkruess/downloads/tracker.php?url=http://mydomain/downloads/apple.zip

This redirected URL is very long and ugly. The best for me would be to redirect this redirected URL to something shorter URL: example: http://mydomain.com/track/downloads/apple.zip..

So the http://mydomain.com/track would be the http://minteddomain.com/mint/pepper/tillkruess/downloads/tracker.php

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

帅冕 2024-09-11 06:15:44

我不完全确定你想做什么。您是否只是想隐藏长网址中的所有“丑陋”并拥有 http ://minteddomain.com/track/www.example.com/whatever.html,然后将重定向到 http://www.example.com/whatever.html?或者,您是否尝试不让 URL 显示您正在重定向用户?

I'm not completely sure what you are trying to do. Are you trying just to hide all the "ugliness" in the long URL and have http://minteddomain.com/track/www.example.com/whatever.html, which will then redirect to http://www.example.com/whatever.html? Or, are you trying not to have the URL show that you are redirecting the user at all?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文