Codeigniter无法删除index.php [英] Codeigniter can't remove index.php

查看:68
本文介绍了Codeigniter无法删除index.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的需要帮助,
与标题相同,我的问题是无法删除我的codeigniter中的index.php

i really need help, same as the title, my problem is can't remove index.php in my codeigniter

我尝试了很多。 htaccess代码,例如:

i had try many .htaccess code like :

// first 
<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /projectFolderName/ --> i already change to my project name

 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>

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

//third
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ – [NC,L]
RewriteRule ^(.*)$ index.php/$1 [NC,L]

//fouth
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

我更改了配置,例如

$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

在我的httd.conf中有一些引用

in some reference in my httd.conf

<Directory />
    AllowOverride All
    Require all denied
</Directory>

我将.htaccess移至主项目文件夹(不在应用程序中)
,但所有操作都没有't work

i move the .htaccess to main project folder (not in application) but all doesn't work

推荐答案

您忘记在<$ c中设置 base_url $ c> application / config / config.php 。设置您的 base_url

You forget to set base_url in application/config/config.php.Set your base_url.

$config['base_url'] = 'your_url';

在根文件夹 .htaccess中

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

还有

$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

在这里工作正常。

这篇关于Codeigniter无法删除index.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆