在codeigniter的.htaccess错误错误、codeigniter、htaccess

2023-09-02 09:51:56 作者:一个过客

我是新来的codeigniter我已经把在codeigniter 2.1.3根文件夹一个.htaccess。 我已经尽了.htaccess文件上都XAMPP和放大器;瓦帕服务器,但是这不是我删除的index.php。 我还设置

I am new to Codeigniter I have put an .htaccess in root folder of codeigniter 2.1.3. I have tried my .htaccess file on both xampp & wamp server but this is not removing my index.php. I have also set

 $config['index_page'] = 'index.php';

 $config['index_page'] = '';

和这里是我的.htaccess code

and here is my .htaccess code

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

我不知道这是为什么不从URL删除我的index.php页面。 帮助我!

i dont know why this is not removing my index.php page from url. help me!!

推荐答案

打开config.php文件,一定要更改$配置['uri_protocol'] ='REQUEST_URI';

Open config.php make sure to change $config['uri_protocol']= 'REQUEST_URI';

和替代该code。在.htaccess文件

and in place this code in .htaccess file

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond $1 !^(index.php|indexcp.php?|resources|robots.txt)
RewriteRule ^([A-Za-z0-9_/.-]+)$ index.php?/welcome/$1 

这就是它为我工作。让我知道如果你仍然面临的任何问题。

That's all it works for me. Let me know if you are still facing any problem.