I can't find any information on doing this specifically but I am basically trying to catch a location like:
http://domain.com/project/Content/Images/image.png
and I want it to point to root like so:
/var/www/$project/Content/Images/image.png
This is what I tried to put together but it doesnt seem to be working:
location ~ ^/(?<project>.+)/Content/^(?<content>.+)$ {
root /var/www/$project/Content/$content;
}
I't doesn't seem to be catching this location as I get a 404 error which is setup with a php page I have with try_files in a location for /. This makes me think the regexp is wrong but I am not sure.
I think you are really close. You have an extra ^ in your regex search string. ^ means "match from the beginning of the line"
location ~ ^/(?<project>.+)/Content/(?<content>.+)$ {
root /var/www/$project/Content/$content;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With