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
如果你在.htaccess文件中有你的规则,那么这里不允许的原因几乎肯定是AllowOverride设置太严格了。 一般来说,它默认设置为允许很less。 在/ etc / apache2 / sites-available / foobar的站点configuration中,添加这个,调整目录path:
<Directory /var/www/mydirectory> AllowOverride +FileInfo </Directory>
重新启动Apache,也许? 如果您正在尝试在.htaccess文件中执行此操作。 当然,“无效的命令”RewriteEngine“”表示mod_rewrite没有启用,无论a2enmod在这件事上可能会说什么。 也许可以确保/etc/apache2/mods-enabled/rewrite.load具有明智的内容,以防万一有些东西在那里有所改变。