2017-04-02 63 views
0

我encouted經常在Nginx的重寫配置:這個表達式在nginx重寫模塊中意味着什麼?

location /main { 
    root /home/hldev/hldata/frontend/credit-system-frontend/dist; 
    rewrite ^/(?!js|css).*$ /main/index.html break; 
} 

^匹配URL的開始,$的URL的末尾匹配,*存在一個或多個,但什麼整體表達的意思?

回答

2

^/(?!js|css).*$是指:與未後跟 「JS」 或 「CSS」((?!js|css))斜線(/)的每個字符串開始(^),考慮直到結束($)的所有字符(.*)。

基本上,所有不以「js」或「css」開頭的相對路徑。

相關問題