我在我的网络服务器上安装了一个CodeIgniter项目(http://sample.org/myproject/)。.htaccess无法正常工作
对于CodeIgniter的路由规则(例如index.php/controller/methode
)我在使用RewriteEngine的myproject
文件夹中编写了一个.htaccess文件。该文件是建立如下:
AuthType Basic
AuthUserFile /home/www/myuser/html/myproject/.htpasswd01
AuthName "secured area"
require valid-user
Options -Indexes
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
现在的问题我已经得到了:如果我把正常的页面(http://sample.org/myproject/index.php/somestuff),它工作正常,但在现阶段,我只能直接调用该目录(http://sample.org/myproject/),这只会工作一些特定的时间。有时它会起作用(在显示此错误的特定时间之后),有时它不起作用。
这是否与浏览器重新读取.htaccess的时间有关?
尝试改变'重写规则*的index.php/$ 0 PT,L]''要重写规则^ $的index.php/$ 1 [ PT,L]' – 2013-02-13 07:30:01
myproject其实是您的$ DOCUMENT_ROOT下的一个真实目录? – anubhava 2013-02-13 08:50:51
@anubhava是的,这是一个现有的.htaccess-File文件夹。 – 2013-02-13 08:56:03