Ankit
Ankit

Reputation: 197

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.

Upvotes: 1

Views: 980

Answers (2)

Mohammad AbuShady
Mohammad AbuShady

Reputation: 42799

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

Upvotes: 3

Gaurav Singla
Gaurav Singla

Reputation: 1451

this will work

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

Upvotes: 0

Related Questions