简体   繁体   English

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

[英]How to hide the redirected URL with mod_rewrite

is there any way to hide redirected url, here is what I think: 有什么办法可以隐藏重定向的URL,这就是我的想法:

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/ 因此,较长的重定向网址http://minteddomain.com/mint/pepper/tillkruess/downloads/tracker.php?url=http://% {HTTP_HOST}%{REQUEST_URI}到较短的类似/mintedomain.com/track/

It is possible? 有可能的?

Adrian 阿德里安

edit: 编辑:

Andrew: 安德鲁:

This is a stats software Mint (haveamint.com) with File Download tracker plugin. 这是一个带有文件下载跟踪器插件的统计软件Mint(haveamint.com)。 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} 在.htaccess中,每个文件(zip,rar,txt等)都被重定向到tracker.php文件(由于统计信息): 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 因此,对于zip文件,重定向的url看起来像这样: http : //minteddomain.com/mint/pepper/tillkruess/downloads/tracker.php? url= http : //mydomain/downloads/apple.zip

This redirected URL is very long and ugly. 重定向的URL非常长且难看。 The best for me would be to redirect this redirected URL to something shorter URL: example: http://mydomain.com/track/downloads/apple.zip .. 对我来说,最好的办法是将该重定向的URL重定向到较短的URL:例如: 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 因此, http://mydomain.com/track将是http://minteddomain.com/mint/pepper/tillkruess/downloads/tracker.php

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 ? 您是要隐藏长网址中的所有“丑陋”内容,还是拥有http://minteddomain.com/track/www.example.com/whatever.html ,然后它将重定向到http://www.example。 com / whatever.html Or, are you trying not to have the URL show that you are redirecting the user at all? 或者,您是否试图不让URL显示正在完全重定向用户?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM