Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
Invalid command 'RewriteCond', perhaps misspelled or defined by a module not included in the server configuration
我运行了a2enmod rewrite
,它显示“mod 已启用”
现在我明白了
RewriteEngine not allowed here
答案1
如果你的规则在一个.htaccess
文件中,那么此处不允许几乎可以肯定AllowOverride
设置太严格了。通常默认设置为允许很少的权限。在站点的配置中/etc/apache2/站点可用/foobar,添加这个,当然调整目录路径:
<Directory /var/www/mydirectory>
AllowOverride +FileInfo
</Directory>
答案2
也许需要重新启动 Apache?如果您尝试在文件中执行此操作.htaccess
。当然,“无效命令‘RewriteEngine’”表示mod_rewrite
未启用,无论a2enmod
对此问题有何看法。也许要确保其/etc/apache2/mods-enabled/rewrite.load
内容合理,以防万一出现一些问题。