首页 > Web开发 > 详细

CI路径中如何去掉index.php

时间:2014-09-24 15:39:08      阅读:237      评论:0      收藏:0      [点我收藏+]

apache去掉index.php

1.编辑conf/httpd.conf配置文件

  #LoadModule rewrite_module modules/mod_rewrite.so 把该行前的#去掉

  同时对应Directory下要配置 AllowOverride All

2.在 CI 根目录下(即在index.php,system的同级目录下)新建立一个配置文件,命名为: .htaccess 内容如下:

  RewriteEngine On

  RewriteCond %{REQUEST_FILENAME} !-f

  RewriteCond %{REQUEST_FILENAME} !-d

  RewriteCond $1 !^(index\.php|robots\.txt)

  RewriteRule ^(.*)$ index.php/$1

  RewriteCond %{REQUEST_FILENAME} !-f

  RewriteRule ^(application|modules|plugins|system|themes) index.php/$1 [L]

3.把system/application/config/config.php 中$config[‘index_page‘] = "index.php";改为$config[‘index_page‘] = ""; 

4.重启apache

 

nginx去掉index.php

1.编辑nginx.conf文件

  vi /usr/local/xxxxx/nginx/conf/nginx.conf

  #nginx去掉index.php

      location / {

         rewrite ^/$ /index.php last;

         #防止某些文件夹被直接访问

         rewrite ^/(?!index\.php|robots\.txt|uploadedImages|resource|images|js|css|styles|static)(.*)$ /index.php/$1 last;

      }

2.config/config.php下配置$config[‘index_page‘] = ‘‘;

3..重启nginx

CI路径中如何去掉index.php

原文:http://www.cnblogs.com/antik/p/3990677.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!