Redirect Non-www to www is not Working

Hi, I am trying to redirect the traffic from non-www to www but it doesn’t work.
I am using heroku which provide only CNAME DNS so I am kind stuck with www

here is what I have on Page Rules:
myweb.com/* Forwarding URL: Status Code: 301 - Permanent Redirect, Url: http://www.myweb.com

When I check the myweb without www. it doesn’t redirect me to www.
I already checked other topics here with the same issue but I couldn’t use their fixes

I just now noticed that non-www response code is (failed)

The order of page rules matter, as only one page rule is triggered for any given URL. Is the above page rule the first of all your page rules?

this is the page rules order

When I was taking the screen shot I edited the order of the the rules, I made url forwarding first after it was second in order and it worked.
Thanks a punch

Glad to hear this!

Anyway, the canonical redirect page rule should have:

From:
example.com/*
To:
https://www.example.com/$1

The * creates the capture group to be copied to where $1 is placed on the target URL, so that:

example.com/some-page-or-file/
is properly redirected to
www.exaample.com/some-page-or-file/

Also, the second page rule, if meant to make the whole site https, is not needed. You can set Always Use HTTPS to ON at the Dashboard > SSL/TLS app.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.