I’ve got some document root which gets listed by the browse directive, now I want to rewrite it to a different root path(from /var/www/app to /var/www/legacy) if a requested file doesn’t exist, but it always results in a 404.
Have somebody already done something like that? Got somebody an idea how to solve that?
I also tried to move the other folder into the document root and hide it with the internal directive, but rewrite to it also results in 404.
So far I have tried it with an approach similar to this, without the success. Would it be possible to fall back with a rewrite to legacy if the file doesn’t exist within current with a custom plugin/directive?
Effectively this results in “try files and folders in ./current, then try files and folders in ./legacy, then 404 out”.
It’s worth cautioning regarding the use of /var/www as the root - if you don’t explicitly rewrite every single request into the subfolder you want, someone could traverse to other folders in there. But as long as you’re careful, this will work.