我在我的網絡服務器上安裝了一個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