I am trying to do a redirect based on what subdomain the user is entering.
For example:
<subdomain>.example.com/admin -> <subdomain>.myurl.com
I want to pass <subdomain> as a parameter to my redirect URL.
I was looking at something along the lines of this:
location ~ (sub).(somewhere).(com)/(some)(thing)/(something)(else) {
set $var1 = $1; # = sub in above example
set $var2 = $2; # = somewhere in above example
set $var3 = $3; # = com in above example
set $var4 = $4; # = some in above example
set $var5 = $5; # = thing in above example
set $var6 = $6; # = something in above example
set $var7 = $7; # = else in above example
rewrite ^ $1/$2 last; # would be sub/somewhere
}