# block direct access to templates, XML schemas, config files, dotfiles, environment info, etc.
location ~ ^/rhymix/modules/editor/(skins|styles)/.+\.html$ {
	# pass
}
location ~ ^/rhymix/(addons|common/tpl|files/(faceOff|ruleset)|(m\.)?layouts|modules|plugins|themes|widgets|widgetstyles)/.+\.(html|xml|blade\.php)$ {
	return 403;
}
location ~ ^/rhymix/files/(attach|config|cache)/.+\.(ph(p|t|ar)?[0-9]?|p?html?|cgi|pl|exe|[aj]spx?|inc|bak)$ {
	return 403;
}
location ~ ^/rhymix/files/(env|member_extra_info/(new_message_flags|point))/ {
	return 403;
}
location ~ ^/rhymix/(\.git|\.ht|\.travis|codeception\.|composer\.|Gruntfile\.js|package\.json|CONTRIBUTING|COPYRIGHT|LICENSE|README) {
	return 403;
}

# fix incorrect relative URLs (for legacy support)
location ~ ^/rhymix/(.+)/(addons|files|layouts|m\.layouts|modules|widgets|widgetstyles)/(.+) {
	try_files $uri $uri/ /rhymix/$2/$3;
}

# fix incorrect minified URLs (for legacy support)
location ~ ^/rhymix/(.+)\.min\.(css|js)$ {
	try_files $uri $uri/ /rhymix/$1.$2;
}

# fix download URL when other directives for static files are present
location ~ ^/rhymix/files/download/ {
	try_files $uri $uri/ /rhymix/index.php$is_args$args;
}

# all other short URLs
location /rhymix/ {
	try_files $uri $uri/ /rhymix/index.php$is_args$args;
}
