Wampserver loglevel重写不起作用

时间:2013-10-12 15:37:49

标签: .htaccess mod-rewrite wampserver

我正在使用WampServer,我想从.htaccess调试我的重写规则,因为我仍然收到404错误。

我已经启用了rewrite_module,log_debug_module,log_forensic_module和log_config_module,但在我的错误日志中,我没有收到任何有关.htaccess的信息。

在httpd.conf中,我将LogLevel更改为:LogLevel warn mod_rewrite.c:trace8。我还尝试了以下选项:rewrite_modulemod_rewrite.sorewritemod_rewrite

然后,当我重新启动服务器时,我只收到此日志,但当我尝试转到localhost/mysite时,我没有收到任何关于网络请求的信息。

[Sat Oct 12 17:33:07.063441 2013] [mpm_winnt:notice] [pid 8884:tid 412] AH00422: Parent: Received shutdown signal -- Shutting down the server.
[Sat Oct 12 17:33:09.063556 2013] [mpm_winnt:notice] [pid 1632:tid 288] AH00364: Child: All worker threads have exited.
[Sat Oct 12 17:33:09.078557 2013] [mpm_winnt:notice] [pid 8884:tid 412] AH00430: Parent: Child process 1632 exited successfully.
[Sat Oct 12 17:33:48.859832 2013] [mpm_winnt:notice] [pid 8252:tid 412] AH00455: Apache/2.4.4 (Win64) PHP/5.4.12 configured -- resuming normal operations
[Sat Oct 12 17:33:48.859832 2013] [mpm_winnt:notice] [pid 8252:tid 412] AH00456: Server built: Feb 22 2013 22:08:37
[Sat Oct 12 17:33:48.859832 2013] [core:notice] [pid 8252:tid 412] AH00094: Command line: 'c:\\wamp\\bin\\apache\\apache2.4.4\\bin\\httpd.exe -d C:/wamp/bin/apache/Apache2.4.4'
[Sat Oct 12 17:33:48.867833 2013] [mpm_winnt:notice] [pid 8252:tid 412] AH00418: Parent: Created child process 6216
[Sat Oct 12 17:33:49.145848 2013] [mpm_winnt:notice] [pid 6216:tid 288] AH00354: Child: Starting 150 worker threads.

更新
以下是有关我的文件夹结构的更多信息。我已将DirectoryRoot设为D:/www,而.htaccess文件位于D:/www/mysite

httpd.conf中的一些部分:

<Directory />
    AllowOverride none
    Require all granted
</Directory>

DocumentRoot "D:/www"
<Directory "D:/wamp/www">
    Options Indexes FollowSymLinks
    AllowOverride All

#    Require all granted
#   onlineoffline tag - don't remove
     Order Deny,Allow
     Deny from all
     Allow from 127.0.0.1
     Allow from ::1
     Allow from localhost
</Directory>

#ErrorLog "logs/error.log"
ErrorLog "c:/wamp/logs/apache_error.log"

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn rewrite:trace3

禁用rewritemodule会在RewriteEngine上出错,所以我想它确实找到了我的.htaccess文件。

这是我的.htaccess文件:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*?)/?$ index.php/$1

2 个答案:

答案 0 :(得分:2)

你是否正在使用Apache 2.4.x,如果是这样,他们已经在记录方面做了重大改变。

尝试

LogLevel alert rewrite:trace3

另一个变化是记录的信息被写入正常的error_log文件。

Documentation

添加其他信息后添加

你的httpd.conf文件中有一些相当明显的错误。

我是否可以建议您在WAMPServer论坛Wampserver 2.4 What to do after Installing

上查看此文档

我刚刚改变了我的WAMPServer Apache conf:

LogLevel warn rewrite:trace8

在重写模块的apache_error.log中有很多额外的行。

确保您实际上在服务器上运行了一些将运行mod_rewrite和您.htaccess

中的RewriteRule的内容

错误:

#WRONG Allows access to the root of your D: drive and all subfolders, great for hackers
<Directory />
    AllowOverride none
    Require all granted
</Directory>

#CORRECTED
<Directory />
    AllowOverride none
    Require all denied
</Directory>

#WRONG
DocumentRoot "D:/www"

#CORRECTED
DocumentRoot "d:/wamp/www"

#WRONG
<Directory "D:/wamp/www">
    Options Indexes FollowSymLinks
    AllowOverride All

#    Require all granted
#   onlineoffline tag - don't remove
     Order Deny,Allow
     Deny from all
     Allow from 127.0.0.1
     Allow from ::1
     Allow from localhost
</Directory>


#CORRECTED
<Directory "D:/wamp/www">
    Options Indexes FollowSymLinks
    AllowOverride All

#   onlineoffline tag - don't remove
     Require local
</Directory>

答案 1 :(得分:0)

将'httpd.conf'日志编辑为

LogLevel alert rewrite:trace3

您应该重新启动apache服务器以应用更改。