简体   繁体   中英

nginx rewrite rule exclude numbers

Need some help with Nginx write rule such that:

All urls of type:-

/1.1.1/xyz/abc/z.js
/2.2.2/xyz/def/c.css

are re-directed to

/xyz/abc/z.js
/xyz/def/c.css

Want to exclude the numeric part which comes at the beginning of URL.

location ~ ^/[0-9\.]+(/.*) {
    try_files $1 $1/;
}

this will work

rewrite ^/(d+).(d+).(d+)/(.+)$ /$1;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM