How to block URLs without / (slash) in the end of URL?

Hello,
I need to block USERs and BOTs for URLs without / (slash) in the end but except home page.
How to do it in the RULES?
Examples:
https://example.com/post-521676 must blocked but https://example.com/post-521676/ - allow
https://example.com - allow
https://example.com/ - allow
Please help me!
Thanks
Alex G.

From my understanding, I am not sure if you could achieve it using a Firewall Rule without a Regex (requires higher Paid plan), but web browsers do add the trailing slash to the URL, either the browser is fixing an invalid URL itself.

Rather, redirect those requests using a Page Rule or Cloudflare Worker.

Even, both cases can represent different thing, content, etc., as far as they are treated as different URLs just by that trailing slash.

Could be I am wrong.

Other resurceful posts:

2 Likes

I already set canonical and page rules(301 redirect) but bots take urks without slash anyway