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

后端 未结 27 1382
盖世英雄少女心
盖世英雄少女心 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:59

    I have tried many solutions but the one i came up with is this:

    DirectoryIndex index.php
    RewriteEngine on
    
    RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|downloads|jquery|js|robots  \.txt|favicon\.ico)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ ./index.php?$1 [L,QSA]
    

    This iwill remove the index.php from the url as required.

提交回复
热议问题