douluo2930 2015-01-17 05:25
浏览 45
已采纳

从codeigniter中的url中删除index.php

I tried to remove index.php from url. I tried more links from linkden but have not worked. I tried following.

1.add .htaccess file with following data,

 RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule .* index.php/$0 [PT,L]

2.changed in config.php $config['index_page'] = '';

3.activate mod_rewrite.

But still not working.

  • 写回答

3条回答 默认 最新

  • doushun1870 2015-01-17 06:05
    关注

    Make .htaccess file in root of project directory with following contents:

    RewriteEngine on
    RewriteCond $1 !^(index\.php|resources|robots\.txt)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
    

    modify application/config/config.php with following:

     $config['index_page'] = '';
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?