首先,在有人发布此链接之前,我会告诉您我已仔细阅读并尝试了它所说的内容,但无济于事。 .htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
我在网站上使用 Codeigniter 并试图删除 URL 中的 index.php。此代码已添加到我网站根目录中的 .htaccess 文件中。
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
当我对其进行测试时,出现了 500 内部服务器错误。检查错误日志是说“无效命令'RewriteEngine'”。在 mods-enabled 文件夹中列出了 rewrite.load。另外,我在启用重写后重新启动了 Apache。
花了几个小时弄乱这个,仍然有同样的问题。提前致谢。
.htaccess 代码来源:http://ellislab.com/codeigniter/user-guide/general/urls.html
最佳答案
“无效命令‘重写引擎’”
你确定这里的“Rewrite”和“Engine”之间没有空格吗? htaccess 语法在涉及空格时不是很宽容,使用“重写引擎”肯定会使它崩溃。
关于apache - 无效命令 'ReWriteEngine',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17376199/