我的 smart404.php 代码中有一个全局变量 debug_smart404:
$debug_smart404 = intval(get_option('debug_smart404' ));
error_log("smart404_redirect: debug_smart404 =" . ( $debug_smart404 ) );
我使用了很多地方:
if ( $debug_smart404 > 4 ) # lotsa debug!
{
error_log("smart404_redirect: take_1st_match=" . ( $take_1st_match ? "yes" : "no" ) );
error_log("smart404_redirect: take_exact_match=" . ( $take_exact_match ? "yes" : "no" ) );
error_log("smart404_redirect: search_whole_uri=" . ( $search_whole_uri ? "yes" : "no" ) );
error_log("smart404_redirect: walk_uri=" . ( $walk_uri ? "yes" : "no" ) );
error_log("smart404_redirect: ignored_patterns_input=" . $patterns );
error_log("smart404_redirect: ignored_patterns_array=" . join($patterns_array,",") );
error_log("smart404_redirect: search_groups=" . join($search_groups,","));
}
while ( TRUE )
{
error_log("smart404_redirect:inside while: debug_smart404 =" . ( $debug_smart404 ) );
...
if ( $debug_smart404 > 3 ) # less debug
{
error_log("smart404_redirect: search_words=" . $search_words);
}
...
if ( $debug_smart404 > 0 ) {
error_log("smart404_redirect: uri=" . $uri . "= #matches=" . $mct);
}
...
} #end while...
所以当我设置 debug_smart404 == 5 时,我得到了 while 之外实例的预期输出:
[Thu Mar 14 08:32:42 2013] [error] [client xx.xx.xx.xx] smart404_redirect: debug_smart404 =5
[Thu Mar 14 08:32:42 2013] [error] [client xx.xx.xx.xx] smart404_redirect: take_1st_match=yes
[Thu Mar 14 08:32:42 2013] [error] [client xx.xx.xx.xx] smart404_redirect: take_exact_match=yes
[Thu Mar 14 08:32:42 2013] [error] [client xx.xx.xx.xx] smart404_redirect: search_whole_uri=no
[Thu Mar 14 08:32:42 2013] [error] [client xx.xx.xx.xx] smart404_redirect: walk_uri=yes
[Thu Mar 14 08:32:42 2013] [error] [client xx.xx.xx.xx] smart404_redirect: ignored_patterns_input=wp-.*\r\n(ing|s|er|est)$\r\nprivate/.*
[Thu Mar 14 08:32:42 2013] [error] [client xx.xx.xx.xx] smart404_redirect: ignored_patterns_array=@wp-.*@i,@(ing|s|er|est)$@i,@private/.*@i,@/(trackback|feed|(comment-)?page-?[0-9]*)/?$@i,@\\.(html|php)$@i,@/?\\?.*@i
[Thu Mar 14 08:32:42 2013] [error] [client xx.xx.xx.xx] smart404_redirect: search_groups=pages,posts,categories
[Thu Mar 14 08:32:42 2013] [error] [client xx.xx.xx.xx] smart404_redirect:inside while: debug_smart404 =5
但请注意,while 循环的 if 语句中的 error_log 输出丢失了……但仅在我的生产服务器(netsol vps)上
它在我的测试服务器(lighttpd)上运行良好:
2013-03-14 08:26:40: (mod_fastcgi.c.2711) FastCGI-stderr: smart404_redirect: debug_smart404 =5
smart404_redirect: take_1st_match=no
smart404_redirect: take_exact_match=no
smart404_redirect: search_whole_uri=yes
smart404_redirect: walk_uri=yes
smart404_redirect: ignored_patterns_input=wp-.*
(ing|s|er|est)$
private/.*
smart404_redirect: ignored_patterns_array=@wp-.*@i,@(ing|s|er|est)$@i,@private/.*@i,@/(trackback|feed|(comment-)?page-?[0-9]*)/?$@i,@\.(html|php)$@i,@/?\?.*@i
smart404_redirect: search_groups=pages,posts,categories
smart404_redirect:inside while: debug_smart404 =5
smart404_redirect: search_words=cavitronix.com xxx zzzxxxx
smart404_redirect: uri=/cavitronix.com//xxx/zzzxxxx= #matches=0
呜呜呜???在两者上运行 php5,并且它曾经在 vps 上工作(此处调试 = 1 输出)-:
[Thu Mar 14 06:32:55 2013] [error] [client xx.xx.xx.xx] smart404_redirect: uri=/how-it-works= #matches=1
[Thu Mar 14 06:41:32 2013] [error] [client xx.xx.xx.xx] smart404_redirect: uri=/videos/e2c-overview/private/awstats/current/new.html= #matches=10
[Thu Mar 14 06:53:38 2013] [error] [client xx.xx.xx.xx] smart404_redirect: uri=/current/previous.html= #matches=3
[Thu Mar 14 06:54:47 2013] [error] [client xx.xx.xx.xx] smart404_redirect: uri=/press-releases= #matches=3
或者这是netsol的vpshackery的一些功能?