Reputation: 741
how to redirect to index.html
for all the url except when the url has one particular QueryString?
For example:
Redirect all other url with Query strings to index.html
except when it has ngsw-cache-bust
example.com/ngsw.json?ngsw-cache-bust=0.24039143891136616
i tried the following code
server {
index index.html;
root /dist;
listen 80;
location / {
try_files $uri$args $uri$args/ /index.html;
}
}
what am i missing?
Upvotes: 1
Views: 412
Reputation: 14259
Perhaps you could try something like this
server {
index index.html;
root /dist;
listen 80;
location / {
if($arg_ngsw-cache-bust == "") {
rewrite ^(.*)$ /index.html last;
}
}
}
Upvotes: 1