小编Pau*_*aul的帖子

从URL中删除index.php - Codeigniter 2

我无法从Codeigniter中的URL中删除index.php.我用Codeigniter 1.7创建了一些网站,我使用的.htaccess代码在2中不起作用.

我试过用

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ ./index.php/$1 [L]

</IfModule>
Run Code Online (Sandbox Code Playgroud)

我也尝试过没有RewriteBase/in.

我已将$ config ['uri_protocol']更改为REQUEST_URI和QUERY_STRING而没有.

我设置了$ config ['index_page'] ="";

文件结构是192.168.0.130/(site)/所以它必须返回到服务器的根目录,找不到index.php文件.

我所做的所有控制器都可以通过192.168.0.130/(site)/index.php/testcontroller来实现.

谢谢.

如果之前有人问过这个道歉 - 我已经看过并尝试过我能看到的东西.

编辑:

我还应该补充一点,我将默认文件夹更改为

应用

CI-2.0

的index.php

并将index.php中的路径更改为正确.

php .htaccess codeigniter

29
推荐指数
2
解决办法
4万
查看次数

标签 统计

.htaccess ×1

codeigniter ×1

php ×1