How to change nginx root directory to another directory dynamically without a redirect, depending on a certain condition? For instance, if:
$http_user_agent ~* "googlebot"
something like this
server {
...
if ($allow = no) {
set $variable "folder_1";
}
if ($allow = yes) {
set $variable "folder_2";
}
root /var/www/$variable;
...
location / {
...
}
}