所以我使用Kohana這是有用的,如果你知道它,但不需要幫助我。Mod_Rewrite重寫目錄我不希望它
我有以下mod_rewrite的規則:
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/store/.*$
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php [L]
所以我試圖改寫爲不存在index.php
文件和目錄的所有請求。
但是,我希望發送到mydomain.com/store/*
的任何請求都通過,因爲在store
目錄中有另一個htaccess文件可以在那裏工作。目前看來這似乎不奏效。有任何想法嗎?
完整的htaccess:
# Turn on URL rewriting
RewriteEngine On
# Installation directory
RewriteBase/
#ErrorDocument 404 http://www.mydomain.com/404Page.html
#Options +FollowSymlinks
# Protect hidden files from being viewed
<Files .*>
Order Deny,Allow
Deny From All
</Files>
RewriteCond %{REMOTE_ADDR} !^myip
RewriteCond %{REQUEST_URI} !^/maintenance\.html$
RewriteRule ^(.*)$ http://www.mydomain.com/maintenance.html [R=307,L]
##301 Redirect Rules##
#some 301 redirects i did not include here
##Kohana Redirect Rules##
# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|system|kohana|vendors)\b.* http://www.mydomain.com/ [L]
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/?store/
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php [L]
注意我還嘗試了以下規則:'RewriteRule^store - [L,NC]' – thatidiotguy 2013-02-14 18:37:19
如果'/ store'是一個物理目錄,'!-d'檢查就足夠了,'/ store'條件不會是必要的。別的地方有點不對勁。 – 2013-02-14 19:05:41
@SalmanA你是完全正確的。我是白癡,並沒有在實際商店direkry – thatidiotguy 2013-02-14 19:40:56