CodeIgniter removing index.php from url

前端 未结 30 1405
[愿得一人]
[愿得一人] 2020-11-21 11:51

My current urls look like this [mysite]index.php/[rest of the slug].
I want to strip index.php from these urls.

mod_rewrite

30条回答
  •  甜味超标
    2020-11-21 12:01

    You can eliminate index.php from URL by create .htaccess file in the base directory of your porject, that file its content as

    RewriteEngine on
    RewriteCond $1 !^(index\.php|assets|images|js|css|uploads|favicon.png)
    RewriteCond %(REQUEST_FILENAME) !-f
    RewriteCond %(REQUEST_FILENAME) !-d
    RewriteRule ^(.*)$ ./index.php/$1 [L]
    

    save that file also your changed in config.php file is right

    $config['index_page'] = '';
    

    I wish to run successfully

提交回复
热议问题