How to remove “index.php” in codeigniter's path

后端 未结 27 1387
盖世英雄少女心
盖世英雄少女心 2020-11-22 07:17

How do I remove the \"index.php\" sticking out in every path in codeigniter somewhere in the center? I want clean non index.php-fied URLs?

27条回答
  •  孤街浪徒
    2020-11-22 07:58

    There are two way to solve index.php in url path for codeigniter

    1:In config/config.php Change code :

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

    to

    $config['index_page'] = '';
    

    2:Create .htacess in root path if not created,Copy the following code:-

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

    Save it and then check in your Apache Configuration rewrite_module OR mod_rewrite is Enabled.If not then please enabled. (Best Approach)!

提交回复
热议问题