当前位置: 代码迷 >> Access >> CI的htaccess配备
  详细解决方案

CI的htaccess配备

热度:7821   发布时间:2013-02-26 00:00:00.0
CI的htaccess配置
最近突然想把链接中的index.php去掉,网上搜索了一把,发现解决方法很多,整理下。

首先是两个基本修改点:

1. 在httpd.conf中,将 所有 AllowOverride None  改为 AllowOverride All 好像共有三处吧,然后重启apache

2. 将 config.php中的  $config['index_page'] = 'index.php';  改为 $config['index_page'] = '';

然后根据具体配置:

3.1 如果站点直接位于服务器根目录下,如/www/ 那如下配置就行:

RewriteEngine onRewriteCond $1 !^(index\.php|robots|stafile|upload|\.txt)RewriteRule ^(.*)$ /index.php/$1 [L]


3.2 如果设置了别名,则加上 RewriteBase /别名/

3.3 如果位于根目录下的二级目录,则修改Rewrite Rule为:

RewriteEngine onRewriteCond $1 !^(index\.php|robots|stafile|upload|\.txt)RewriteRule ^(.*)$ /mysite/index.php/$1 [L]


最后,有个htaccess教程,可以详细了解下各个配置。
http://www.javascriptkit.com/howto/htaccess.shtml
  相关解决方案