我正在使用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_module
, mod_rewrite.so
, rewrite
,mod_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.
更新
这是有关我的文件夹结构的更多信息。我已经把我的 DirectoryRootD:/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
禁用重写模块会导致错误RewriteEngine
所以我想它确实找到了我的 .htaccess 文件。
这是我的 .htaccess 文件:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*?)/?$ index.php/$1