server {
	listen   80; 
 	server_name example1.com *.example1.com;
	location / {
		root /var/www/default;
		index index.html index.htm;
		if ($cookie_env ~* "testing") { 
            	rewrite ^(.*)$   /testing/$1;
        } 
        if ($cookie_env ~* "staging") {
 					rewrite ^(.*)$   /staging/$1; 
        } 
        if ($cookie_env ~* "production") { 
  					rewrite ^(.*)$   /production/$1;
        }
	}
}
