Answer the question
In order to leave comments, you need to log in
How to set exceptions in nginx rewrite regular expression?
All .js files are redirected to a php script for processing and subsequent output of the formatted .js file. The challenge was to keep all .js paths the same. The code below is failing.
set $domain $host;
rewrite "^/gzip/(.*)$" /gzip.php?file=http://$domain/$1 last;
location ~* \.js$ {
rewrite_log on;
rewrite "^/(.*)$" /gzip/$1 last;
}
/gzip/file.js
/gzip/gzip/file.js
/gzip/gzip/gzip/file.js и т.д.
Answer the question
In order to leave comments, you need to log in
You have some kind of complex scheme, but why not just do it like this?:
location ~* \.js$ {
rewrite_log on;
rewrite "^/gzip/(.*)$" /gzip.php?file=http://$domain/$1 last;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question