$1 at least has a slash.
map $request_uri $requri {
default $request_uri;
/ "";
}
[...]
rewrite ^(\/.*) https://example.com/ar$requri permanent;
map $request_uri $requri {
default $request_uri;
/ "";
}
[...]
rewrite ^(\/.*) https://example.com/ar$requri permanent;