Page Rule Not Working Root to Subdomain


#1

Hey all, new to the platform and was looking for assistance!

I have a page rule from the root to the test subdomain not working as expected. The domain used is a free domain, as my goal was to do a quick test.

I have the following:
learntoprogramforfree.ga/*

Forwarding URL - 301 Redirect

http://test.learntoprogramforfree.ga/$1

I have an A record in place that is proxied through the Cloudflare (orange cloud). I confirmed this because whatsmydns.net reports an entirely different IP for that A record. No other page rules are in place.

learntoprogramforfree.ga returns www.learntoprogramforfree.ga
learntoprogramforfree.ga/test returns learntoprogramforfree.ga/test

No DNS records exist for the www subdomain.

Am I missing something? Thanks in advance!


#2

Your rule isn’t matching the URI scheme. It needs http:// in front for a full match.

If your site responds to www and non-www, it gets a bit trickier. You’d need two rules (one for each form), or for .htaccess to rewrite www to non-www, or vice-versa. Sites should stick with one or the other.


#3

Thank you for the insight! Updating the origin URL to http://learntoprogramforfree.ga/* generates the 301 redirects as expected.

I added a second rule specifically for http://learntoprogramforfree.ga to http://test.learntoprogramforfree.ga, but it only works if I explicitly type “http://” before learntoprogramforfree.ga. If I type learntoprogramforfree.ga in my browser, I still get www.learntoprogramforfree.ga. Is there not a way to redirect all HTTP requests to a specific subdomain in one rule, much like GoDaddy’s forward functionality?

I understand if I had an htaccess file in place that would complicate the situation, but right now the A record for learntoprogramforfree.ga points nowhere (its just to enable the proxy) and there are no DNS records for www.learntoprogramforfree.ga. No server exists for learntoprogramforfree.ga.

Any additional suggestions would be much appreciated!


#4

From my browser, as well as curl in verbose mode, I get a 301 to the test domain when I type in learntoprogramforfree.ga

See if clearing your browser cache will fix it.


#5

A post was merged into an existing topic: Want to redirect pangu.in/* to m.pangu.in/* for mobile device with cloudflare