2013-09-13 15:50:29
来 源
IT技术网
Apache
该篇讲述Apache服务器配置.htAccess文件解决非法命令RewriteEngine的方法,希望对于初学Apache服务器相关的朋友有帮助,更多Apache安装、配置、报错处理等资源请本站内搜索。
在使用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

声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。