我的服务器上有一些现有的 PHP 代码。现在我想要登录有关到达我的服务器的请求的完整信息。我不想对现有代码进行任何更改。我为此使用 apache mod_rewrite。我有一个示例 php 脚本,stats.php,它看起来像这样
<?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>
问题是,恐怕从 SEO 的角度来看这可能不是最好的,也可能是错误的。有没有更好的方法来做到这一点?例如,我可以对 access_log 文件使用脚本吗?