How to remove index.php in codeigniter's code?

前端 未结 3 471
小鲜肉
小鲜肉 2021-01-28 21:56

I want to remove index.php from url in codeigniter . So in user guide, there is way to do it by editing .htaccess.But my host do not allow to edit it. Is there any way to do wit

3条回答
  •  北海茫月
    2021-01-28 22:11

    put the following code in .htaccess

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

    and put $config['index_page'] = ''; in config file instead of $config['index_page'] = ''; put the .htaccess near to index.php out of system and application folders

提交回复
热议问题