使用 htaccess 跟踪访客?

发布于 2024-09-19 08:59:34 字数 208 浏览 4 评论 0原文

我有一个演示服务器,我在其中放置应用程序的示例,并向潜在客户发送指向这些应用程序的链接。是否可以使用 htaccess 来跟踪访问者,而无需向应用程序本身添加跟踪功能?我感兴趣的数据是:

  1. 页面访问的日期和时间
  2. 访问者的IP
  3. 访问页面的URL
  4. 引用者
  5. 帖子并获取(查询字符串)数据(如果有)

I have a demo server where I put samples of my apps, I send potential customers links to those apps. Is it possible to use htaccess to track visitors, without adding tracking capability to the apps themselves? The data I'm interested in are:

  1. date and time of page visit
  2. ip of visitor
  3. url of the page visited
  4. referrer
  5. post and get (query string) data if any

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

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

发布评论

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

评论(4

缱倦旧时光 2024-09-26 09:00:31

我知道这个线程已经安静了一段时间,但我无法使用 prepend?在所有访问前面添加脚本以跟踪站点/页面访问的指令?

我还没有得到代码(尝试了类似的东西,尽管没有成功),但我使用了 prepend 指令来预先添加一个脚本,该脚本在 gzip 上“切换”所有站点访问。我相信日志也可以实现同样的功能(对于我们这些拥有廉价共享服务器的人来说!)来吧,程序员们,帮我们大家一个忙,揭开这个秘密!

I know this thread has been quiet for a while, but i it not possible to use the prepend?? directive that prepends a script to all visits to track site/page visits ?

I have not got the code (tried something similarthough was not successfull) but I used the prepend directive to prepend a script that "switches" on gzip for all site visits. I am sure the same can be implemented for logs (for those of us with cheap shared servers!) Come on coders, do us all a favour and reveal the secret!

浅暮の光 2024-09-26 09:00:22

使用谷歌分析的最佳方式。
您将得到您所需要的一切以及更多。

Best way it to use google analytics.
You will get all what you need and much much more.

孤寂小茶 2024-09-26 09:00:13

不,不可能使用 .htaccess 文件,因为它只是一个配置文件,而不是可执行文件。

不过,您可以使用另一种网络服务器功能 - 日志文件。
您要求的所有内容都已存储在访问日志中,几乎与您在此处列出的格式相同。

重要提示:与谷歌分析或任何其他第三方或脚本解决方案不同,网络服务器日志是唯一可靠且准确的跟踪数据来源,包含向您的网站发出的所有请求。

no, that's impossible to use .htaccess file, because it's merely a configuration file, not executable one.

However you can use another web-server capability - log files.
Everything you asking for is already stored in the access log, almost in the same format you listed here.

An important note: unlike google analytics or any other third-party or scripting solution, web-server logs is the only reliable and exact source of tracking data, contains very request been made to your site.

夏夜暖风 2024-09-26 09:00:04

这完全取决于您的网络服务器,它为 htaccess 覆盖提供了哪些选项。

对于 Apache,访问日志会记录您正在查找的内容
http://httpd.apache.org/docs/current/logs.html#访问日志
无法通过 htaccess 配置

That entirely depends on your webserver, what options it provides for htaccess overrides.

For Apache, the access log logs what you are looking for
http://httpd.apache.org/docs/current/logs.html#accesslog
but is not configurable via htaccess.

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