301 redirect


#1

HI, I have a basic question ( i think) I have just set a new site on a cloudflare account and I want to point an old domain to this new domain using an A record (as I want to keep email with the old domain).

should I be pointing the a record to the cloudflare server ip or my hosting account IP ( digital ocean)?

Thanks for your help on this


#2

Hi there.

I think you’re asking if you can perform a redirect using DNS? Short answer is no:

However, you can use Page Rules for redirects, which is thoroughly outlined in this article:
https://support.cloudflare.com/hc/en-us/articles/200172286-How-do-I-perform-URL-forwarding-or-redirects-with-Cloudflare-


#3

If possible, please elaborate little more in
the precise way. What exactly you are trying to achieve? Thanks


#4

Hi, thanks for your answer, but the domain I want to redirect is not on a cloudflare account, I just want to to point to the domain that is.

so domain A is an older domain ( hosted elsewhere and not on cloudflare), I want to point to domain B ( which is on cloudflare)

which ip address should I point the redirect to, the cloudflare IP or the web server IP?

thanks


#5

Thanks for clarifying. I believe the web server (origin) IP is what you’d want to point to


#6

Thanks Andy, I thought that too, but why I asked to question was just incase I changed web hosting companies in the future?

I dare say I would have the domain on the same cloudflare account longer than hosting it with the same company/location?

So if pointed the redirect to the cloudflare IP, and I did change my hosting company and transferred that site to another location it wouldn’t affect the redirect right? or is there something fundamentally wrong with pointing to a Cloudflare IP?

cheers


#7

How are you managing DNS for domain A currently? Through your hosting provider? Is there a specific reason that domain A is not on Cloudflare?


#8

yeah its through another hosting provider,

The situation is that I have created a new site for the client and using a new domain and hosting on my server,but I do not have access to their server where the old site is hosted, naturally I want to have the traffic from the old site redirected to the new site.

I told the client just to point the old domain to where the new domain is hosted and gave him that ip, but after he pinged the (new) domain he saw that it resolved to a different ip address ( cloudflare) and is now asking all these questions :frowning:


#9

So what do you think? should I be pointing to old domain to the cloudflare ip or my hosting ip… I am actually starting to think it might have to be pointing to cloudflare - thoughts?


#10

Sorry for the delay. It’s very early here still and I’m trying to understand your exact situation.

Did the redirect work though? Also, this is normal. Cloudflare will mask your origin IP

You cannot point to a Cloudflare IP and direct IP access is not allowed. Ping the new domain, get the Cloudflare IP you mentioned above and navigate to it in your browser - you will see a Cloudflare error 1003.


#11

Oh I see, thanks, for the article and advice!