0
我需要拒絕所有人訪問整個網站,除了一些IP地址。 另外,我需要允許網站的一個文件夾爲大家訪問:如何在mod_rewrite中創建複雜的條件?
Options +FollowSymLinks
Options +Indexes
RewriteEngine on
# Allow access only for devs
RewriteCond %{REMOTE_ADDR} !10.10.10.10 [NC] # First dev id
RewriteCond %{REMOTE_ADDR} !11.11.11.11 [NC] # Second dev id
# Allow direct access to files
RewriteCond %{REQUEST_FILENAME} !-f
# Redirecting guests
RewriteRule (.*) /coming/soon/index.html [R=307]
# But where to place this condition?
RewriteRule ^/?preview/?$ /preview/index.html [NC]
# Other rules for main site structure
# ...
所以,我需要整個網站只加載的開發者。其他用戶(嘉賓)將會看到/coming/soon/
頁面 而且客人也可以看到該網站的/preview/
頁面。
如何做到這一點?
謝謝。你的第一個想法非常簡單,它的工作原理=) –