2016-09-14 49 views

回答

0

類似於下面的內容應該可以工作。

RewriteEngine on 
RewriteRule ^sub\.domain\.com/(js/*\.js)$ static-sub.domain.com/$1 [NC,R,L] 
RewriteRule ^sub\.domain\.com/(*\.jpg)$ static-sub.domain.com/$1 [NC,R,L] 
RewriteRule ^sub\.domain\.com/(*\.css)$ static-sub.domain.com/$1 [NC,R,L] 

您可能需要調整它以適應您的特定場景。注意捕獲組的使用((js/*\.js))來存儲要在目標中使用的可變路徑信息($1)。還請注意NC,RL選項;它表示「沒有外殼」(情況無意義),「重定向」(重定向請求)和「最後規則」(如果此規則匹配,則停止處理更多規則)。