Forwarding page rule not working


#1

Hello

I have recently moved all my domains to CloudFlare.

One of my clients has 4 domains with her own name (these are obviously just examples):

  1. example-domain.com
  2. exampledomain.com
  3. domain-example.com
  4. domainexample.com

Domain #1 is the primary domain. The 3 others are not directly in use, so I wan’t to forward a user visiting either three of them to #1.

I have changed the nameservers at the registrar and created the following page rule (with different URL matches of course) for #2-4 ~40 hours ago:

The domain names are just examples

Why am I not being forwarded to #1 when visiting #3? Is it because I have not created any record for #2-4. If yes, which record should I create? Should I point them to the same host as I have done in #1? I haven’t found a clear answer to that in the support section.


#2

My dear,

It’s not working because -

  • Instead of writing *.exampledomain.com/* you should write http://*exampledomain.com/*

Above, I made two changes - First I added http:// second, I removed DOT because it has no use in your case.


Another important thing …

Why it’s not working for you… because if you want to have forwarding from all three domain to your one main domain, therfore you must add all those extra (Just I am saying) domains to your Cloudflare Dashboard.

Then try to create forwarding rule like this from each domain

http://*extra-domain1.com/*  to http://www.maindomain.com/$2
http://*extra-domain2.com/*  to http://www.maindomain.com/$2
http://*extra-domain3.com/*  to http://www.maindomain.com/$2

Thanks & Regards,
Gulshan


#3

Okay. Well I just did what CloudFlare explained here: https://support.cloudflare.com/hc/en-us/articles/218411427

They’re setting up the rule like I did. Will yours, with http://, also resolve requests beginning with ‘www’? Any request to extra-domain1, 2 and 3 must forward the user to the main domain.


I have already created all 4 domains in CloudFlare and the 3 domains all have a forward page rule.


#4

Do you have an orange clouded DNS record for the the domains and host names you with to use the page rules for? If the traffic never reaches Cloudflare we can’t redirect the traffic.


#5

Thanks for your reply.

There are 0 records for the secondary domains, and I’m asking if I need to create records for those, for the page rule to work, even though the only purpose of these 3 secondary domains is to forward to the main domain.

Since you say, that the clouds should be orange, that tells me I do have to create records for the forwarding domains. Is that correct? And if that is the case, which record(s) should I create, and what should they point to?


#6

Hi @jeppeskovsgaard,

Thanks for confirming. For the hosts/subdomains you would want to resolve you’d need to create DNS records. These could all be cname records to therealdomain.com. I think actually in theory they should work gray or orange clouded as long as the target is orange clouded.


#7

Okay. Thanks. I’ll try that out.

I’m not a DNS expert yet, I’m still just a novice. My previous DNS host automatically created the appropriate DNS-records that would make the forward work. Those records pointed to their own servers though - I guess different DNS hosts have different ways to do it.


#8

So I have tried to create a wildcard cname and an a-record for extradomain1.com, pointing to the same server as maindomain.com

The page rule is still not working. Visiting extradomain1.com gives me the standard Siteground defaultwebpage.cgi page, because no hosting account exist for that domain name. I am not being forwarded.


#9

I’d recommend opening a ticket with support, that way we can look at the specifics of your zones and rules you’re trying to create to assist.


#10

With the help of the CloudFlare support I solved the problem:

  • The pagerule URL match must be *exampledomain.com/* without the dot (.) to match any request.
  • For page rules to work, there must be at least one a-record with traffic running through the CloudFlare proxy (orange cloud). That record can point to any IP-address, because the page rule will fire before the record. I pointed it to the host of my primary domain though.

Thanks to CloudFlare support!