我的 Apache 错误日志文件中出现以下错误:
[Fri May 20 16:17:06 2011] [notice] Apache/2.2.17 (Ubuntu) PHP/5.3.5-1ubuntu7.2 with Suhosin-Patch configured -- resuming normal operations
[Fri May 20 16:17:11 2011] [alert] [client 127.0.0.1] /home/zomerovic/vhosts/brillelook/public_html/.htaccess: Invalid command 'RewriteCond', perhaps misspelled or defined by a module not included in the server configuration
[Fri May 20 16:17:12 2011] [alert] [client 127.0.0.1] /home/zomerovic/vhosts/brillelook/public_html/.htaccess: Invalid command 'RewriteCond', perhaps misspelled or defined by a module not included in the server configuration
[Fri May 20 16:17:12 2011] [alert] [client 127.0.0.1] /home/zomerovic/vhosts/brillelook/public_html/.htaccess: Invalid command 'RewriteCond', perhaps misspelled or defined by a module not included in the server configuration
[Fri May 20 16:17:12 2011] [alert] [client 127.0.0.1] /home/zomerovic/vhosts/brillelook/public_html/.htaccess: Invalid command 'RewriteCond', perhaps misspelled or defined by a module not included in the server configuration
但是我已经启用了 mod_rewrite 以及其他 apache mod(正如 a2dismod 所说):
Your choices are: auth_basic authn_file authz_default authz_groupfile authz_host authz_user autoindex cgi deflate dir env headers mime negotiation php5 reqtimeout setenvif status vhost_alias
RewriteCond 是否与其他一些模块有冲突,或者我遗漏了什么?
谢谢。
答案1
跑步
a2enmod rewrite
/etc/init.d/apache2 restart
它将为你加载重写模块
您看到的错误不是因为您没有使用重写的权限,而是因为它不可用,从您提供的 a2dismod 列表输出中可以看出(它没有出现在列表中)
答案2
您可以在 .htaccess 文件中使用 mod_rewrite 吗?
看允许覆盖文件信息