apache - 无效命令 'ReWriteEngine'

标签 apache .htaccess codeigniter mod-rewrite

首先,在有人发布此链接之前,我会告诉您我已仔细阅读并尝试了它所说的内容,但无济于事。 .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/

相关文章:

apache - 在 laravel @Apache2 Server Ubuntu 14.04 LTS 中将根设置为公共(public)文件夹

regex - urlrewrite 中 $1 之后的数字

apache - 删除域后的斜杠

php - 如何使用 errordocument 重定向到同一文件夹中的 php 文件?

php - Codeigniter - 插入多个表

php - 优化 mod_rewrite

php - 增加最大帖子大小

apache - .htaccess 上的 mod_rewrite 将主文件夹映射到子文件夹

javascript - 如何停止每个ajax调用的音频?

php - 无法在 codeigniter 中使用 where 和 join 条件获取结果