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

时间:2010-10-13 06:40:54

标签: .htaccess codeigniter

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

1 个答案:

答案 0 :(得分:5)

请参阅CodeIgniter Manual

在您的文档根目录中,包含以下内容的.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]

然后在application/config/config.php更改:

$config['index_page'] = '';