Codeigniter htaccess只在根目录下重定向到index.php

时间:2016-09-22 05:55:07

标签: php apache .htaccess codeigniter

我在Codeigniter中有像这样的结构目录

/application
/assets
/system
.htaccess
index.php
test.php

这是我的.htaccess文件

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

我想要的是,如果用户访问除index.php之外的任何其他PHP或HTML文件,它将被重定向到index.php。例如,如果有人访问test.php,它将被重定向到index.php。但我希望它只适用于根目录而不影响到其他目录

我已经尝试过here,但它对我不起作用

0 个答案:

没有答案