I need to rewrite an nginx rewrite rule, but cant figure out how to do it.
This is my example URL:
cdn.example.com/public/storage/upload/images/1/2/3/4.jpg
cdn.example.com/public/storage/upload/images/1/2/3.jpg
I want to convert it to
cdn.example.com/storage/app/public/upload/images/1/2/3/4.jpg
cdn.example.com/storage/app/public/upload/images/1/2/3.jpg
I am not sure how can I just add storage/app/
in front of the original URL and remove the storage
after public
from the original URL?
The regex would be:
/public/storage/ /storage/app/public/
Assuming /public/storage/ does not appear anywhere else. Otherwise, include the domain name as well. If 'storage' is a pattern, then
/public/([a-z]+)/ /$1/app/public/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.