2010-09-17 21 views
1

我需要關閉整個站點,所以我想將所有請求都路由到登錄頁面。 mod_rewrite是什麼樣子的?我的指令在Firefox中給我一個「永不完全」的錯誤。mod_rewrite所有內容到一個登錄頁面

RewriteEngine on 
RewriteCond %{REQUEST_URI} !^[^.]*/$ 
RewriteRule ^(.*)$ /alert.php [R=301,L] 

回答

2

你重定向到匹配重寫模式的頁面,所以當瀏覽器嘗試要求它作爲301重定向,它就會再次被重定向的結果(導致一個無限循環,Firefox是足夠聰明通知)。你會想要添加一個例外規則,以避免這種情況:

# the conditions are implicitly combined 
# with a logical AND 
RewriteCond %{REQUEST_URI} !=/alert.php 
RewriteCond %{REQUEST_URI} !^[^.]*/$ 
RewriteRule ^(.*)$ /alert.php [R=301,L] 
+0

mod_rewrite是什麼樣子的? – 2010-09-17 19:32:33

相關問題