apache 省略index.php访问

1,修改httpd.conf文件,下面的地方:
<IfModule dir_module>
DirectoryIndex index.htm index.html index.html.var index.php
</IfModule>

在APACHE服务器上的访问方式上去除index.php
 
下面我说下 apache 下 ,如何 去掉URL 里面的 index.php 
例如: 你原来的路径是: localhost/index.php/index 
改变后的路径是: localhost/index 

2.httpd.conf配置文件中加载了mod_rewrite.so模块 //在APACHE里面去配置 
#LoadModule rewrite_module modules/mod_rewrite.so把前面的警号去掉 

3.在APACHE里面去配置 ,将里面的AllowOverride None都改为AllowOverride All

注意:修改之后一定要重启apache服务。 

4.确保URL_MODEL设置为2, (url重写模式)

在项目的配置文件里写 

return Array( 
‘URL_MODEL’ => ’2′, 
); 
5 .htaccess文件必须放到跟目录下 

这个文件里面加: 


RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.*)$ index.php/$1 [L] 
原文地址:https://www.cnblogs.com/aprils/p/5141440.html