如何通过htaccess从url隐藏index.php

Bha*_*ana -1 .htaccess codeigniter

关于Code Igniter和MySql:
如何通过htaccess隐藏url中的index.php?

chi*_*ley 5

请参阅CodeIgniter手册.

在文档根目录中,.htaccess包含以下内容的文件:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt) # these are examples,
                                                 # add everything here that
                                                 # you **don't** want to be
                                                 # routed to CI
RewriteRule ^(.*)$ /index.php/$1 [L]
Run Code Online (Sandbox Code Playgroud)

然后application/config/config.php改变:

$config['index_page'] = '';
Run Code Online (Sandbox Code Playgroud)