JoeV587 发表于 2016-6-6 18:57:39

CI3.0 去URL中index.php 遇迷离问题,求帮忙!

本帖最后由 JoeV587 于 2016-6-6 19:13 编辑

在网上查询了好多方法,都不能用,哪位大神弄过,帮忙告诉下,
环境windows,apache
采用什么方法修改呢。这是网上的方法
————————————————————————————————————————
然后,在 CI 根目录下新建立一个配置文件,命名为: .htaccess
在里面这样写:
[*]RewriteEngine on
[*]RewriteCond $1 !^(index\.php|images|robots\.txt)
[*]RewriteRule ^(.*)$ /index.php/$1

就可以去掉 index.php 了。要注意 /index.php/$1 要根据你目录(Web 目录,比如 http://www.domain.com/index.php)的实际情况来定,比如网站根目录是 /ci/index.php 则要写成 /ci/index.php/$1

[*]RewriteCond $1 !^(index\.php|images|robots\.txt)
[*]$config['index_page' = "index.php";
[*]改为$config['index_page' = "";
————————————————————————————————————————

这样修改完以后还是不行,目录会出现
http://localhost/srgk//home/znst_index
必须加一个问号才行例如:
http://localhost/srgk/?/home/znst_index 这样才能访问通
谁知道,帮忙告诉下,多谢了



JoeV587 发表于 2016-6-6 19:13:09

有谁改过index.php ,帮忙指导下,多谢了~:hug::hug::hug:

JoeV587 发表于 2016-6-6 19:13:58

这样修改完以后还是不行,目录会出现
http://localhost/srgk//home/znst_index
必须加一个问号才行例如:
http://localhost/srgk/?/home/znst_index 这样才能访问通
谁知道,帮忙告诉下,多谢了

yuzhigang5460 发表于 2016-6-7 09:45:29

<IfModule mod_rewrite.c>
    RewriteEngine On
   RewriteBase /srgk/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>
页: [1]
查看完整版本: CI3.0 去URL中index.php 遇迷离问题,求帮忙!