无责任的烂笔头

Concentrate & enjoy!
posts - 3, comments - 15, trackbacks - 0, articles - 7
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

非法命令RewriteEngine

Posted on 2010-04-05 19:49 BZ 阅读(1323) 评论(2)  编辑  收藏 所属分类: Misc
  在使用Access File时,页面出现500 Internal Error. 检视Apache错误日志是发现: .htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration. 
  Google后才发现, RewriteEngine命令需要rewrite mod的支持。从而, 做如下修复:
  $>cd /etc/apache2/mods-enabled    切换到apache下的mods-enabled目录
  $>sudo ln -s ../mods-available/rewrite.load rewrite.load   启用rewrite mod
  $>sudo /etc/init.d/apache2 restart    重启apache服务器

注:rewrite.load的内容为: LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so  也就是加载mod_rewrite模块。

评论

# re: 非法命令RewriteEngine  回复  更多评论   

2010-08-26 13:53 by 王海涛
我的问题和你的是一模一样,RewriteEngine和RewriteRule都是非法命令,但是我的系统是XP+Apache+PHP5,我该怎么改啊。?

# re: 非法命令RewriteEngine[未登录]  回复  更多评论   

2010-08-26 16:35 by Brian
@王海涛
将Apache安装目录下的conf/httpd.conf文件中对mod_rewrite模块的加载打开
#LoadModule rewrite_module modules/mod_rewrite.so
--> 去掉前面的#, 然后重启
LoadModule rewrite_module modules/mod_rewrite.so

只有注册用户登录后才能发表评论。


网站导航: