1.进入/usr/local/apache/conf/httpd.conf,
注释掉:DocumentRoot "/usr/local/apache/htdocs",该成:DocumentRoot "/var/www/";
启用:Include conf/extra/httpd-vhost.conf;
2.修改配置文件的的Allowoverride(两处都修改了)
http://www.jb51.net/article/30120.htm
3.确定apache配置文件httpd.conf下安装了路由重写模块并开启了路由重写模块。
(源码编译方式安装不会自动安装模块)。
文件路径:usr/local/apache/conf/original/httpd.conf
(路径:LoadModule rewrite_module modules/mod_rewrite.so)
http://gaoxingf.blog.51cto.com/612518/190362/
3.虚拟机配置文件添加路由重写文件
ServerAdmin 123.45.23.76
DocumentRoot "/var/www/gcash"
ServerName 123.45.23.76
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
但是配置成上面的形式可能会导致部分的文件无法解析,即一些可以访问,
一些不能访问,所以,我们增加解,析配成下面的形式:
ServerAdmin 123.45.23.76
DocumentRoot "/var/www/gcash
ServerName 123.45.23.76
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
DirectoryIndex index.php index.html (新增加的一行)
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]