Page Rule URL Redirect not Working

Hi,
I am trying to redirect my domain from .ca to .com.
I have a URL redirect page rule with code 301 to redirect from wildrosemining .ca/ to wildrosemining .com.

I have configured an A record with a dummy IP (192.0.2.1) and a CNAME record for www.
Both records are run through Cloudflare proxy.

I also have some mail records for Cloudflare mail forwarding and that works fine.

It’s hitting a 503 for some reason, can you post a screenshot of your page rule(s)?

(actually the WWW redirect is working it’s just the apex domain redirect that isn’t)

Hi,

Thanks for the quick reply.

Here is a screenshot of the only page rule that is on:

I don’t think you can cover your apex domain & www subdomain with a single page rule

You can do *.example.com to cover all subdomains but it won’t match the apex domain

If it supported proper regexes you could but it doesn’t

so make another rule for your apex domain

also, the way you did the rule, everything will be redirected to the root of the site (paths won’t be preserved), is that what you want?

if you want to preserve the rest of the URL you’ll need to throw a backreference like $1 or $2 in the destination depending how many *'s you’re using

Hi,

Since the structure of the new website is different. I don’t need to preserve the site paths.

What should I do for a page rule to cover the apex domain?

Thanks

I think the way it is at the moment without the . should cover both. It was tested and worked here:

@noah.cramer, did your old site use Shopify?

I have successfully used the Page Rule syntax that @noah.cramer shared, placing the wildcard before the first character of the apex domain. It comes straight from the “Helpful tips” section of the Page Rules Tutorial.

I still use it for changing settings, but for redirects I have moved from Page Rules to Bulk Redirects.

With as often as Cloudflare for SaaS partners wind up with stale hostnames, that is definitely a good question.

well folks are saying you should be able to hit them both with a single rule, so it could be something else going on but unless you’ve used up all your page rule slots you might as well try a separate rule for the apex domain:

When you try to hit the apex domain, the response headers are weird though, I’ve never seen this X-DC stuff before

HTTP/1.1 503 Service Unavailable
Date: Tue, 14 Jun 2022 19:05:58 GMT
Content-Type: text/html
Connection: keep-alive
X-Dc: gcp-us-central1
X-Request-ID: dcfc4e9f-466a-46d4-8263-eb978cad7673
CF-Cache-Status: DYNAMIC
Server: cloudflare
CF-RAY: 71b5572abb628723-ORD
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400

My guess was that it wasn’t hitting the page rule & Cloudflare’s proxy was giving a 503 because it’s not allowed to try to pass the request along to the dummy IP you specified… but maybe not.

This is why I asked this

I’m fairly confident that will be the issue here.

Yes, the old site did use shopify

This issue is due to the fact that Shopify use Cloudflare for SaaS, hostname priority means requests are still going there instead of your Cloudflare setup because they have not removed it properly . Please contact them and ask them to remove any Cloudflare configurations for your domain, specifically SSL for SaaS / Custom Hostnames. They will likely push back but if you get the right person this should be resolved very quickly.

1 Like

Hi,

Thanks for the info, will do!

I would have never realised

2 Likes

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