Domain redirect not working for site

https://www.mysecretstore.com/ is not redirecting to https://shop.mysecretstore.com/ although I set the rules in cpanel redirection.

Host says that as I am using cloudflare DNS, that’s why redirect is not working.

How do I resolve this?

Something on your origin is redirecting www directly to the 404 page.

You have a CNAME in place in the Cloudflare DNS for ‘shop’ which is working so you could do the redirect on Cloudflare instead.

curl -I https://www.mysecretstore.com
HTTP/2 302
date: Sun, 19 Nov 2023 21:13:18 GMT
content-type: text/html; charset=UTF-8
x-robots-tag: noindex, nofollow
location: /404.html
cache-control: no-cache, no-store, must-revalidate
pragma: no-cache
expires: 0
cf-cache-status: DYNAMIC
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=NymPJ4inEpp86Qear5KRuaXsZJUnLPhxXVhGzB6itoyNMweSOVLpf5JhDZntY6yySVWVhpMkJeL1Ay43M5zpRYEjtyBVg4hXNg%2BKpLNkt5a0P%2FSzmcDCIforW1wiEF14K8wahtDJkA%3D%3D"}],"group":"cf-nel","max_age":604800}
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
server: cloudflare
cf-ray: 828b74d06fe160f7-LHR

How do I do the redirect on Cloudflare?

I tried

Redirect Rules

URL equals https://www.mysecretstore.com/

To redirect to

static https://shop.mysecretstore.com/

and it did not work

Like this…

Thank you. It worked for only www.mysecretstore.com

but it did not work for

https://mysecretstore.com/
http://mysecretstore.com

How do I add that in?

Change “Hostname” “equals” to “Hostname” “is In” then enter www.mysecretstore.com and mysecretstore.com as 2 items in the same box one at a time.

Still did not work for

https://mysecretstore.com/
http://mysecretstore.com

It was redirecting www earlier. Check the rule is enabled…

[edit] Just noticed there is a space at the end of mysecretstore.com in your screenshot. You can see it in the expression preview. Take that out.

It all works now, thank you for the fantastic suggestions