Forwarding with Page Rule

pagerules

#1

I am trying to forward mydomain.mx to mydomain.com/mx.

Currently, it only forwards to mydomain.com.

What in my context is incorrect, please? Does this require 2 page rules?

(asterisk)mydomain.mx/(asterisk)

Forwarding URL (301 Permanent Redirect)

https://www.mydomain.com/mx


#2

Hello @kacey!

You just need to create a forwarding page rule either 301 or 302 (depend on your need) with the configuration as follow:

the $1 means that you’re keeping the URI in the redirection, have a look at that guide for more explanations: https://support.cloudflare.com/hc/en-us/articles/218411427


#3

Thank you so much, @stephane,

Unfortunately I must have something else interfering as it is not working for me. I tried a few variations as well. Any thoughts on what else I could look at?


#4

With nothing else in your root htacess file (mydomain.mx)
add this simple 301 that directs the new location.
Nothing else, just this.

Redirect 301 / https://mydomain.com/mx/

This snippet is the same as on css tricks,
under snippets > htaccess > redirects


#5

@kacey If you want me to look at what happening, i’ll need the name of your domain :slight_smile:


#6

That would be awesome! It is protemaxseguro.mx


#7

When i’m doing a request on www.protemaxseguro.mx i’m being redirected to www.protemaxseguro.com/mxwww so i assume that you’re using two Wilcard in your page rule. If yes, you’d use $2 at the end of the redirection pattern since that represents the second wildcard catch.

Then, you probably have a redirection in your webserver because the 301 is working normally since I’m seeing the /mxwww but I’m directly redirected (302) again to /.

This isn’t a Cloudflare configuration, didn’t see anything doing that in your second CloudFlare domain.

image


#8

Thank you SO much @stephane! Tweaked the .com page rules and everything seems happy now!