Www and non www with only on 301 redirect rule

Is there a way to have www and non www request be redirected with a single rule? I tried placing an * at the beginning of the domain and also an * at the end. In Firefox it seems to work, but in Edge and Chrome, the redirect appends a www to the end of the redirected URL and results in a page not found error. I checked the help on Cloudfare and it doesn’t specifically address this and only references the * in one particular way. Thanks for any help.

*example.com/* will do it. That’s how I redirect an entire domain to another URL.

It sounds like you’re using $1 instead of $2 for the path. If you post a screenshot of your rule, we can take a closer look.

Attached is a screenshot of the rule.

$1 matches the first *, and $2 matches the second *, (then $3 and so on). Your Forwarding URL should end with a $2.

1 Like