Need help ignoring root path

I have this redirect rule on my .htaccess file:

RewriteCond %{HTTP_HOST} ^(www.)?jetsystemservices.com [NC]
RewriteRule ^$ https://www.spotitonline.com/jet-system-services [R=302,L]

This redirect my root path only to external site that is not part of my Wordpress site.

When Cloudfare does its thing goes directly to the external site instead of my WP site which is found in “D/wp-admin” for Administration and configuration which by the way is a multisite and the pages are in “D/en/home”, and others like “D/es/inicio”, “D/mobile/en/home”, “D/mobile/es/inicio” (mobile stands for mobile/tablet devices) and others (D stands for my domain).

I need help to make Cloudfare don’t follow the redirect and cache the above sites.

It sounds like this would be better handled with Cloudflare’s own page rules instead of htaccess on your origin server, but I haven’t tried exactly this redirect config you’re attempting.

Try creating a “Forwarding URL” page rule in the Cloudflare dash. Just don’t use the * wildcard or you’ll redirect the whole domain.

I added the forward rule without asterisk and removed the rue on htaccess, but Cloudfare still thinks my site is on the external link.

I had forward url from jetsystemservices.com/ to https://www.spotitonline.com/jet-system-service, now I change the forward url from jetsystemservices.com/ to https://jetsystemservices.com/en/home.

But Cloudfare is ignoring the rule still is going directly to jetsystemservices.com/

Do you have other page rules above it? The rules need to be in priority order, so this rule needs to trigger before any other rule that could match a request for the root domain.

If that’s not it, sorry, I’m all out of ideas then. I’m not sure if there is different behavior or issues to think about when it’s the root domain like this.

No. I set IT to be the first rule.

I removed the .htpaccess rule for redirection and removed the forward rule, but know I have a mess in my Dns propagation, all points to the redirection link. After removing the forward rule will it triggers a new dns propagation?

There’s no relation between page rules and DNS propagation.

You did not say what rule you created on Cloudflare. Here’s one that should work for what you need (replacing the target URL with the full domain/path of the destination)

I did use the same rule but to my particular link, actually I use mydomain/ without the beginner “*”. On htaccess on my site I had:
RewriteCond %{HTTP_HOST} ^(www.)?jetsystemservices.com [NC]
RewriteRule ^$ https://www.spotitonline.com/jet-system-services [R=302,L]
As I had on my first post. Maybe the Page rule did not cause the Dns mess but the redirect made Cloudflare mess his dns table.

I you go to DNS Checker - DNS Check Propagation Tool you will see the IP for my site is wrong, it has the IP of the redirection link. When I make Cloudeflare to disable it gets the correct IP (31.220.20.167).

Your RewriteCond is matching the whole HTTP_HOST, not a specific page. So all requests coming to that host would be redirected. You should change that, but I’m not sure exactly what would work in your case, as .htaccess directives can be quite moody depending on other server configurations.

In theory, your .htaccess directive would be ignored by Cloudflare if you have the proper Page Rule set to redirect the request at the edge. So I believe you should open a ticket with support to investigate why your Page Rule redirect is not performing as expected.

DNS checkers should show the 3 IP addresses that Cloudflare assigned to your domain, not your origin IP address. But if you have recently paused Cloudflare for testing, these checkers may reflect that and show a mix of the Cloudflare IPs and your origin’s . You should avoid doing this very often, as some DNS servers may take a long time to update a change after another change was made recently.

1 Like

Now I decided to migrate my Wordpress multisite to a subdomain (main.jetsystemservices.com) and the parent domain has the htaccess rule to redirect to the external site. The htaccess rule is more granular than the CF page rule, it only redirect the root, the root/page and root/path/page are not redirected, even has to be the exact domain name. Thus I need to Cloudflare to not cache the root instead cache the subdomain.

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