Answer the question
In order to leave comments, you need to log in
Need help building a regular expression for Nginx?
Hello. Need help writing a regular expression. Since only the elite can learn this elven magic, I turn to you for help.
Condition:
There is a url:
http://example.com/assets/Irbis/moto/IRBIS%20XR250/DPP_0015-400x400.png
however, there is nothing along that path. $document_root/image/data/Irbis/moto/IRBIS%20XR250/DPP_0015.png
here lies the image. http://example.com/assets/Irbis/moto/IRBIS%20XR250/DPP_0015-400x400.png
there was an internal redirect to$document_root/image/data/Irbis/moto/IRBIS%20XR250/DPP_0015.png
. http://example.com/assets/(.*)/(.*)/(.*)/(.*)-400x400.png
(the number of folders in the path after assets can be anything, the file extension is (png|jpg) ). Answer the question
In order to leave comments, you need to log in
rewrite "^/assets/((?:[\s\w]+/)+)([\s\w]+)-400x400\.(png|jpg)" /image/data/$1$2.$3 last;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question