0
這是我的.htaccess文件htaccess的重寫規則存取權限REAL目錄
Options +FollowSymlinks
RewriteEngine On
RewriteBase/
# Force add trainling slash
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ http://foo.bar/$1/ [R=301,L]
# Prepent www if not exist in URI
RewriteCond %{HTTP_HOST} ^foo\.bar$
RewriteRule (.*) http://www.foo.bar/$1 [R=301,L]
# If path is not a directory or file then apply RewriteRule
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite for profile view
RewriteRule ^([^/]+)/?$ profile.php?user=$1 [NC,L]
# Rewrite for page view
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ account.php?type=$1&user=$2&page=$3 [QSA,L]
# Condition to ignore regular links
RewriteRule ^library/templates/([^/]+)/([^/]+)/([^/]+)/?$ library/templates/$1/$2/$3 [QSA,L]
# Rewrite for dynamic page settings
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ account.php?type=$1&user=$2&page=$3&$4=$5 [QSA,L]
# Rewrite for account view
RewriteRule ^([^/]+)/([^/]+)/?$ account.php?type=$1&user=$2 [QSA,L]
# Rewrite for site default resources location
RewriteRule ^([^/]+)/([^/]+)/theme/s/([^/]+)/([^/]+)/([^/]+)/?$ library/themes/site/$3/$4/$5 [QSA,L]
我知道這是有點不走這個最好的方式,感覺就像有太多的冗餘,但我沒有專家,但它爲我工作。如果任何人都可以給我建議如何使這個更高效,我會高度讚賞它。
好了,所以我的問題是,我有
www.foo.bar/path/to/real/dir
一個真正的目錄,我想訪問一個文件在該目錄中,但我重寫規則是不讓進入該目錄,除非我提出一個新的重寫規則重定向我的網址。
讓我檢查出來,我就報什麼我發現 – Eli 2011-03-21 21:11:50