Apache .htaccess – 如何重写引用?

我有一个网站www.example.com。

我想实现以下目标:从www.example.com上点击www.example.com上的所有访问,获取推荐人www.example.org

换一种说法。 我想用www.example.org重写引用者www.example.net。 在www.example.com的服务器日志中,stream量将来自www.example.org而不是www.example.net

如果有人从网页上点击www.example.com ,例如www.example.net/whatever/ ,在日志中我想看到www.example.org 。 所以我不想看到这些页面作为引用。 只需www.example.org的主页就足够了。

如何实现它? 谢谢

这肯定可以用类似的东西来实现

 SetEnvIf Referer example\.com myreferer CustomLog access.log combined env=!myreferer CustomLog access.log "%h %l %u %t \"%r\" %>s %b \"http://www.example.com/\" \"%{User-agent}i\"" env=myreferer 

如果用户来自example.com,则第一行设置环境variablesmyreferer。 设置时,第三行指定修改的日志格式,否则使用标准的“组合”日志格式。

我还是不build议这样做,因为这会导致信息丢失。 如果你试图做到这一点,因为你需要这些查阅者在某种日志分析工具上显示为一个,你应该在工具本身中进行设置。