I've managed to find a rewrite for making subdomains (which I have a wildcard domain pointed to my server; *.domain.com.
If I go to test.domain.com, it works just fine which transverse to:
/var/www/domain.com/www/test/
If I do example.test.domain.com, it should do this:
/var/www/domain.com/www/test/example/
Which is another directory in the test directory.
This is the rewrite I found to be used, but how should I implement the two directory subdomain in this?
if ($host !~* ^www\.domain\.domain$) {}
if ($host ~* ^([^.]+)\.domain\.com$) {
set $auto_subdomain $1;
}
if (-d /var/www/domain.com/www/$auto_subdomain) {}
if (-f /var/www/domain.com/www/$auto_subdomain$uri) {
rewrite ^(.*)$ /$auto_subdomain$uri;
break;
}