2011-11-24 55 views
0

我有設在這裏兩個網站資源...阿帕奇重寫第三目錄深度爲第一目錄深度

localhost/index.php /* rewrite handler */ 
localhost/images/ 
localhost/scripts/ 

然後,我有兩個網站...

localhost/site1/ 
localhost/site2/ 

我想重寫...

localhost/site1/images/ 
localhost/site2/images/ 
localhost/site1/scripts/ 
localhost/site2/scripts/ 

...到...

localhost/images/site1/ 
localhost/images/site2/ 
localhost/scripts/site1/ 
localhost/scripts/site2/ 

有沒有辦法讓「site1」和「site2」成爲一個動態變量(這樣我就不必手動添加一個例外或規則,如果我將來會增加更多的網站)方式?

這條規則重寫目錄,我希望能夠和訪問文件,而不僅僅是指數...

RewriteRule .*\/scripts\/$ scripts\/$1 [L] 

回答