Nginx Rewrite router

1

Good morning guys,

Is there any way I can do the rules below without having to always repeat the root folder, in this case without needing to see all of the words " 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;
}
    
asked by anonymous 06.04.2016 / 14:05

0 answers