my site has redirection issue to homepage,
when I clear the cache from Cloudflare then it works fine, but after sometimes, or couple of hours, its pages start redirection to home page and cannot be visited,
when I purged the cache then it start working properly,
APO or not, the first visit to your website after Cloudflare cache is purged will be returned from your origin. There must be a redirect set at your origin, which then is cached by Cloudflare. Check your installation for redirections by .htaccess, WordPress itself, or some plugin. I suspect it’s a plugin, as the redirects start after a couple of hours. Visit your site with Dev Tools open on the Network tab (F12), then check for headers with name X-Redirect-By. If available, it may point to the right direction.