I am trying to make a url rewrite as following:
location /statics/ {
alias /var/project/statics/;
}
location /statics/cache {
rewrite /statics/cache/(.*?)/(.*)$ http://$host/statics/$2 last;
}
Where URL would be as:
http://ANY-DOMAIN.com/statics/cache/1.2.5/file/path/file.js
The original file is:
http://ANY-DOMAIN.com/statics/file/path/file.js
The problem here is: URL is redirecting (changing URL) to original file. I want to prevent the redirection.
Current status:
Redirects to original URL
I found the answer by Changing the Mask URL as following:
new url: http://ANY-DOMAIN.com/cdn/cache/1.2.5/file/path/file.js
instead of http://ANY-DOMAIN.com/statics/cache/1.2.5/file/path/file.js
And the rewrite rule to be as: