I’ve recently tweaked my wordpress website in order to add a 301 redirect on some pages based on several criterias.
My problem is that pages still responds with a 200 status code and I can’t figure why.
I’ve disabled the cache (wordpress side) for those pages in order the clearly identify that the issue doesn’t come from there and when I add a random query string at the end of the URL, the redirect works like charm.
Basically, I think that the problem is related to Cloudflare, but if I’m right, I don’t know where and why.
I understand your point, but actually I’m exploring every leads.
The fact that the behavior is different with or without a query string typically makes me think that the problem is linked to the cache.
I’ve excluded the wordpress cache, so the only one that remains is Cloudflare.
Development mode only disables the cache, so to properly rule out Cloudflare you might want to pause it altogether (that you resolve then straight to your server and skip Cloudflare), but as mentioned earlier, Cloudflare generally does not change the status code so this most likely really is coming straight from your server and will require debugging at that end.