Nginx Rewrite router

Asked

Viewed 45 times

1

Good morning guys,

there is some way that I can make the rules below without having to keep repeating the root folder, in this case without having to see all write "rewrite /Pw/... /Pw/... last;"

location /pw {
    rewrite ^/pw/styles/min/img/((.)*) /pw/assets/frontend/img/$1 last;
    rewrite ^/pw/styles/min/fontes/((.)*) /pw/assets/frontend/fontes/$1 last;

    rewrite ^/pw/([^/]*)/css/img/((.)*) /pw/assets/$1/img/$2 last;
    rewrite ^/pw/([^/]*)/css/((.)*) /pw/assets/$1/css/$2 last;
    rewrite ^/pw/([^/]*)/js/((.)*) /pw/assets/$1/js/$2 last;
    rewrite ^/pw/([^/]*)/plugins/((.)*) /pw/assets/$1/plugins/$2 last;
    rewrite ^/pw/([^/]*)/fonts/((.)*) /pw/assets/$1/fonts/$2 last;
    rewrite ^/pw/([^/]*)/img/((.)*) /pw/assets/$1/img/$2 last;

    try_files $uri $uri/ /pw/index.php?$args;
}
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.