2013-06-27 38 views
0

我目前正在寫我的lighttpd的第一條規則,基本上讓我們假設我的域名是http://google.com,我希望當用戶進入任何過去的「/」像http://www.google.com/somethinglighttpd的正則表達式的重定向規則循環

這裏是檢測我現在高達:

url.redirect = (
"^/(.*)" => "/index.php?user=$1", 
) 

它的工作原理,但因爲一個明顯的邏輯故障(帶的index.php是過去/)它創建了一個永無止境的循環。我想要做的是相當於這個:

if (url != index.php) { 
// go ahead and redirect 
} else { 
// dont redirect 
} 

我希望它適用於除index.php之外的每個尾隨請求。任何幫助,將不勝感激!謝謝。

回答

0

Try:

$HTTP["url"] !~ "^.*index\.php$" { 
    url.redirect = (
     "^/(.*)" => "/index.php?user=$1" 
    ) 
}