去除index.php–kohana3使用手册
这里有两个步骤能让 index.php 从 URL 中被移除
首先编辑 bootstrap 文件。查找 bootstrap 文件中的 Kohana::init 这一行,并且在下面增加 index_file 参数:
Kohana::init(array( 'base_url' => '/blog', // You need to edit this also to your needs! 'index_file' => '', ));
你可能认为这样足够了,但是你还需要在 .htaccess 文件中改变一行。
重命名 example.htaccess 文件为 .htaccess 并且更改下面这行代码:
RewriteBase /kohana/
修改为和 bootstrap 文件中的 base_url 一样。如果你的 Kohana 安装在如 example.com/blog/ 的位置,那么就修改为:
RewriteBase /blog/
检修#1
如果无法工作(出现 “interval Server Error” 或者 “No input File Specified”)请尝试修改:
RewriteRule ^(?:application|modules|system)\b - [F,L]
为
RewriteRule ^(application|modules|system)/ - [F,L]
还有修改
RewriteRule .* index.php/$0 [PT]
为
RewriteRule .* index.php [L]
检修#2
如果仍然无法正常使用,请确定 .htaccess 文件是否在 httpd.conf 中被允许启用(然后重启 Apache)
Order allow,deny Allow from all AllowOverride All