2014-02-06 38 views
0

我正在使用Kohana框架。它有.htaccess文件的配置如下:使用.htaccess指令繞過框架服務資源文件

# Protect application and system files from being viewed 
RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L] 

# Allow any files or directories that exist to be displayed directly 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

# Rewrite all other URLs to index.php/URL 
RewriteRule .* index.php [PT] 

我格外感興趣的第二部分Allow any files or directories that exist to be displayed directly。有人可以詳細說明它是如何配置的?使用RewriteCond指令,它的作用就像if condition

RewriteCond %{REQUEST_FILENAME} !-f 

意味着如果請求不是一個有效的文件

RewriteCond %{REQUEST_FILENAME} !-d 

意味着如果請求不是用於有效的目錄

回答

0

這是由於2條件線

兩者都與RewriteRule結合在一起表示如果請求不是有效的文件或目錄,則向前ev請求index.php