关闭/排除Kohana中的路线,例如我的gallery / dir

时间:2011-12-14 00:40:20

标签: php kohana kohana-3

我试图访问画廊/ 2 / image.jpg,但Kohana认为它是一条路线,所以它返回错误“无法找到URI路线画廊”

那么如何关闭特定的目录/路由名称,以便我可以访问图像?

1 个答案:

答案 0 :(得分:0)

你的htaccess看起来应该是这样的

# Turn on URL rewriting
RewriteEngine On

# Installation directory
RewriteBase /

# Protect hidden files from being viewed
<Files .*>
    Order Deny,Allow
    Deny From All
</Files>

# 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_URI} ^.+$
RewriteCond %{REQUEST_FILENAME} \.(gif|jpe?g|png|pdf)$ [OR]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -l
RewriteRule ^ - [L]

# Rewrite all other URLs to index.php/URL
RewriteCond ${REQUEST_URI} ^!galleries/.*$
RewriteRule .* index.php/$0 [PT]

应将其排除在发送到路由引擎之外。

相关问题