I have trouble figuring out how to rewrite this htaccess rule to a nginx rule. It's for a legacy project that uses a static asset version in the url.
The file on the server is for example located in:
assets/js/jquery.min.js
The url to fetch it is:
assets/js/jquery.min.1661243858.js
The htaccess rule is
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*?\/)*?([a-zA-Z\.\-]+)(\d+)\.(bmp|css|cur|gif|ico|jpe?g|js|png|svgz?|webp|webmanifest)$ $1$2$4 [L]
</IfModule>
I tried some converters and found a blog post going over this. But it doesn't seem to be working. I'm using ddev as my environment. Current nginx rule that I set in .ddev/nginx_full/nginx-site.conf, I removed #ddev-generated:
location ~* (.+)\.(?:\d+)\.(js|css|png|jpg|jpeg|gif|webp)$ {
try_files $uri $1.$2;
}