CodeIgniter removing index.php from url

前端 未结 30 1857
[愿得一人]
[愿得一人] 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:15

      Removing index.php from url of codeigniter   
    
    Three steps are require to remove index.php from url in Codeigniter.
    
    1)Create .htacess file in parallel to application holder and just copy past the following code:
    
    RewriteEngine On
    RewriteBase /CodeIgniter/
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php/$1 [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
    
    2) Change $config['index_page'] to blank in config.php in application folder as below:
    
    $config['index_page'] = '';
    
    3) Enable “rewrite_module” of apache.
    

提交回复
热议问题