下面我说下 Apache 下 ,如何 去掉URL 里面的 index.php
例如: 你原来的路径是: localhost/index.php/index
改变后的路径是: localhost/index
1.httpd.conf配置文件中加载了mod_rewrite.so模块 //在APACHE里面去配置
#LoadModule rewrite_module modules/mod_rewrite.so把前面的警号去掉
2.在APACHE里面去配置 ,将里面的AllowOverride None都改为AllowOverride All
注意:修改之后一定要重启apache服务。
3.确保URL_MODEL设置为2, (url重写模式)
在项目的配置文件里写
return Array(
‘URL_MODEL’ => ’2′,
);
4 新建文件名为 .htaccess 的文件,放于根目录下,内容如下:
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)index.php/ index.php/ 1 [QSA,PT,L]
</IfModule>
Ubuntu Server 14.04 安装Web服务器(Linux+Apache+MySQL+PHP) http://www.linuxidc.com/Linux/2015-06/119061.htm
Linux下安装配置PHP环境(Apache2) http://www.linuxidc.com/Linux/2015-05/118062.htm
Linux下 Apache服务器配置 http://www.linuxidc.com/Linux/2016-06/132025.htm
Ubuntu 13.04 安装 LAMP\Vsftpd\Webmin\phpMyAdmin 服务及设置 http://www.linuxidc.com/Linux/2013-06/86250.htm
CentOS 5.9下编译安装LAMP(Apache 2.2.44+MySQL 5.6.10+PHP 5.4.12) http://www.linuxidc.com/Linux/2013-03/80333p3.htm
Linux下Apache服务器配置 http://www.linuxidc.com/Linux/2016-10/136517.htm
Linux下Apache虚拟主机的配置 http://www.linuxidc.com/Linux/2016-04/130381.htm
Apache 的详细介绍:请点这里
Apache 的下载地址:请点这里
本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-11/136767.htm