I want to configure redirection locally, but it fails

I use Cloudflare redirection is correct, but I configure it locally, the configuration is as follows: rewrite /chant/(.*)$ /chant?id=$1 redirect; normal requests can be accessed, but add a ". ", it cannot match the rewrite rules, but I can access it normally by adding “,”
for example:
google/chant/123, can be accessed,
google/chant/123. cannot be accessed