站长论坛

标题: apache 配置.htaccess文件之非法命令RewriteEngine [打印本页]

作者: tznktg    时间: 2011-7-29 14:48
标题: apache 配置.htaccess文件之非法命令RewriteEngine
在使用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模块。

如果是在XP下:
将Apache安装目录下的conf/httpd.conf文件中对mod_rewrite模块的加载打开
#LoadModule rewrite_module modules/mod_rewrite.so
--> 去掉前面的#, 然后重启
LoadModule rewrite_module modules/mod_rewrite.so




欢迎光临 站长论坛 (http://www.tzlink.com/bbs/) Powered by Discuz! X3.2