我如何从Codeigniter 3.1.9的网址中删除index.php

时间:2018-10-25 08:24:51

标签: php codeigniter

我已更改

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

$config['index_page'] = '';

还有

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

$config['uri_protocol'] = 'AUTO';

,并且在.htaccess中,我编写了此代码。但是index.php无法从URL中删除。

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

1 个答案:

答案 0 :(得分:1)

将您的base_url设置为

$config['base_url'] = 'http://localhost/base_folder/

使用此.htaccess

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