在 .htacess 中启用 ReWriteLog 后,我无法打开我的网站。

gia*_*est 0 mod-rewrite httpd .htaccess wordpress apache-2.2

.htaccess 起初运行良好,然后我在 .htacess 中添加了两行以启用 RewriteLog。结果是我无法打开我的网站。

我添加到我的 .htaccess 中的两行如下:

RewriteLog /home/bigmeow/mylog/rewrite.log
RewriteLogLevel 9
Run Code Online (Sandbox Code Playgroud)

启用 rewritelog 的 .htaccess 如下:

less .htaccess
RewriteEngine On
RewriteBase /blog/
RewriteLog /home/bigmeow/mylog/rewrite.log
RewriteLogLevel 9
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
Run Code Online (Sandbox Code Playgroud)

当我尝试打开我的网站时收到的错误消息:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@bigmeow.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. 
Run Code Online (Sandbox Code Playgroud)

我从 error.log 得到的错误信息:

[Thu Aug 16 08:55:16 2012] [alert] [client xx.xx.xx.96] /home/bigmeow/bigmeow.com/blog/.htaccess: RewriteLog not allowed here, referer: http://bigmeow.com/blog/linuxcmd/?p=68  
Run Code Online (Sandbox Code Playgroud)

如果我想让 RewriteLog 运行良好,我应该怎么做?

小智 5

您不能将 RewriteLog 添加到 .htaccess,如下所示。如果要设置 RewriteLog,则必须将其添加到服务器配置或虚拟主机配置中。

RewriteLog Directive
Description:    Sets the name of the file used for logging rewrite engine processing
Syntax:         RewriteLog file-path
Context:        server config, virtual host
Run Code Online (Sandbox Code Playgroud)

http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewritelog