.htaccess首先运行良好,然后在我的.htacess中添加了两行来启用RewriteLog。 结果是我没有打开我的网站。
我添加到我的.htaccess的两行如下:
RewriteLog /home/bigmeow/mylog/rewrite.log RewriteLogLevel 9
启用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]
我尝试打开我的网站时收到的错误消息:
Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [email protected] 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.
我从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
如果我想让RewriteLog运行良好,我该怎么办?
您不能将RewriteLog添加到.htaccess中,如下所示。 如果你想设置RewriteLog,你必须把它添加到服务器configuration或虚拟主机configuration。
RewriteLog Directive Description: Sets the name of the file used for logging rewrite engine processing Syntax: RewriteLog file-path Context: server config, virtual host
http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewritelog
你需要把它放在你的httpd.conf ,看这里:
http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewritelog
上下文:服务器configuration,虚拟主机
你不能把它放在一个.htaccess 。