Fix · Cloudflare
Fix “Exposed .env file” on Cloudflare
Remove .env from the web root, block dotfiles at the server, and ROTATE every secret that was exposed -- assume it is compromised.
// WAF > Custom rule: Block when URI Path contains "/.env"
Verify the fix
Re-run the Exposed .env file check after deploying. Test config changes in staging first and keep a rollback: a wrong header can break a site faster than a missing one.
Other stacks: nginx · Apache · Caddy · Express / Node