如何使用 mod_rewrite 隐藏重定向的 URL
有没有办法隐藏重定向的网址,这就是我的想法:
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不完全确定你想做什么。您是否只是想隐藏长网址中的所有“丑陋”并拥有 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?