我的服务器上有一些现有的PHP代码。现在我想登录关于请求到我的服务器的完整信息。我不想对现有代码进行任何更改。我正在使用Apache mod_rewrite。我有一个示例PHP脚本,stats.php这看起来是这样的apache mod_rewrite收集请求信息
<?php
/*NOTE:This is peseudo code!!!*/
open database connection
add serverinfo, referer info, script_name, arguments info to database
change characters in request from UTF16 to UTF 8.
//Call header function for redirection
$str = Location : $_SERVER["REQUEST_URI"]
header ("$str");
?>
在httpd.conf文件
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !/stats\.php
RewriteCond %{REQUEST_URI} !\/favicon\.php
RewriteRule ^/(.*)$ /stats.php?$1 [L]
RewriteLog "logs/error_log"
RewriteLogLevel 3
</IfModule>
的问题是,恐怕这未必是最好的搜索引擎优化的角度和也可能是越野车。有没有更好的方法来做到这一点?例如,我可以使用脚本访问access_log文件吗?
这是真正的PHP在使用吗?因为没有任何工作,因为它是不正确的语法。 –
@cryptic,它的语法不正确。它被认为是伪代码。我会在文中说清楚。 – user763410