For anyone who comes across this scenario, here is how I got it working:
# get the first folder name into a variable ($site_folder) map $uri $site_folder { ~^/(?P<folder>[a-zA-Z]+)/.* $folder ; } ... server { ... if (!-f $site_folder) { rewrite ^/[^/]+/(.*) /$1; } } I am aware of the "if is evil" thing but it states that it is safe outside of "location" block. Supposedly safe in "server" context. Performance seems good so far. Posted at Nginx Forum: http://forum.nginx.org/read.php?2,251908,251938#msg-251938 _______________________________________________ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx