Nginx try_files search in directory that’s name different from location
My config looks like this.
location ~* ^/currentDomain/ {
root $root/src/
try_files $uri $uri/index.php?$args;
}
So, as I understand it, when I open localhost:8080/currentDomain/ in browser, it searches for ../src/currentDomain/index.php file
I need to change domain name to targetDomain, but don’t rename any folders and don’t change any code.
So when I open http://localhost:8080/targetDomain/, nginx should still search for ../src/currentDomain/index.php
Is it possible to do only with nginx config without changing project files?
So far I tried playing with rewrite, (rewrite ^/currentDomain/(.*)$ /targetDomain/$1 last) but figured that it’s basically used for redirecting, so not my case.
Read more here: Source link
