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
意味着如果請求不是用於有效的目錄