Dolphin
Dolphin

Reputation: 38731

What does this expression mean in nginx rewrite module?

I am encouted a regular in Nginx rewrite config:

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

the ^ match the start of the url,the $ match the end of the url,the * present one or more,but what the whole expression meaning?

Upvotes: 0

Views: 133

Answers (1)

logi-kal
logi-kal

Reputation: 7880

^/(?!js|css).*$ means: for each string starting (^) with a slash (/) that is not followed by "js" or "css" ((?!js|css)), consider all the characters (.*) until the end ($).

Basically, all the relative paths that do not start with "js" or "css".

Upvotes: 2

Related Questions