流沙团
Internal Server Error
2017-5-24 流沙团


0x001 案发现场



对一个项目进行二次开发,Yii的框架项目



移动到本地计算机,wamp2.5的环境 



数据库全部配置好以后, 直接访问后报错



error1.jpg







0x002 找出原因



因为这个项目移植过一次, 上次是wamp2.1的环境, 没有报错。。



估计是配置问题, .htaccess  有了嫌疑



文件直接删除后 网站访问正常!







里面的代码:



Options -Indexes
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
RedirectMatch 404 /\..*
RedirectMatch 404 /web\.config.*



项目分为中文站点和英文站点, 中文站点无法访问了!!







0x003 查看系统日志



wamp的apache日志目录:D:\wamp\bin\apache\apache2.4.9\logs 



找到文件: localhost-error_log







查看报错信息:



[Wed May 24 11:08:18.878718 2017] [core:alert] [pid 9144:tid 856] [client 127.0.0.1:7440] D:/wamp/www/xxx/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration







提示: 'RewriteEngine',  不合法







0x004 解决办法








RewriteEngine命令需要rewrite mod的支持,



打开apache的配置文件httpd.conf ,



取消 LoadModule rewrite_module modules/mod_rewrite.so前的注释








搞定!!!访问正常!

















发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容