if ($http_authorization ~ "."){
	set $rule_0 1$rule_0;
}
if (!-d $request_filename){
	set $rule_1 1$rule_1;
}
if ($uri ~ "(.+)/$"){
	set $rule_1 2$rule_1;
	set $bref_1 $1;
}
if ($rule_1 = "21"){
	rewrite ^/ /$bref_1 permanent;
}
if (!-d $request_filename){
	set $rule_2 1$rule_2;
}
if (!-f $request_filename){
	set $rule_2 2$rule_2;
}
if ($rule_2 = "21"){
	rewrite ^/ /index.php last;
}