Changing Domain Name URL


#1

Hi, I just purchased a new domain name and want to move everything from old domain name to the new one. Both does not have SSL cert but the old domain name has the Flexible SSL enabled. I can’t seem to find any tutorial about changing domain name and best setup practice for it.

  1. Do I need to create a new Cloudflare account for it?
  2. How do I setup 301 redirection in Cloudflare from old domain to new domain?
  3. Do I still need to put in 301 redirection in my hosting?
  4. Since my old domain name does not have a SSL cert, what happens to traffic from https://olddomain.com?

Help is appreciated. Thank you.


#2

Assuming you have the new domain all set up… (if not, you will first need to get it up and running on your web server)

  1. No, you can have multiple domains in your Cloudflare account.

  2. Use a Page Rule to redirect. Either redirect:

> *example.com* with a 301 to https://new.com
Or, if all files and paths map right over to your new domain:

> *example.com* with a 301 to https://new.com/$2

  1. Your old hosting won’t be touched if you do one of the above redirects. Clouflare will intercept all requests and send them to your new domain.

  2. Again, the old domain is a non-issue since it will no longer be used. Leave Flexible SSL on.


#3

Thanks for your reply.

If my url structure is the same such as old.com/p1 is same as new.com/p1 do I choose the (1) or (2) below? By the way, what does $2 means?

  1. example.com with a 301 to https://new.com

  2. example.com with a 301 to https://new.com/$2

Do I need to disable "Always use HTTPS " in the old domain in setting or just leave it as it is?

Also on another note, I have some old deleted pages/renamed urls that were being redirected using a redirection plugin, can I delete the plugin and instead use manual redirection in Cloudflare? For example:
I have previously changed a url olddomain.com/about-us and redirect with plugin to olddomain.com/new-us. Can I just use Cloudflare to redirect olddomain.com/about-us to newdomain/new-us?

Many thanks in advance again.


#4

Use #2. The $2 will include the path (whatever follows the .com). The $variables represent the * wildcard. The first wildcard matches http:// or https:// with or without the www for your old domain. So anybody using a specific content URL on your old site will be redirected to that content location on the new site.

I’d leave Always Use HTTPS on.

I’d keep the redirect plugin. You only get a limited amount of Page Rules here which will get used up quickly for Redirects, and leave you less rules for other customizations.


#5

Thank you very much for your help. Really appreciate it.

So by using option $2 it will also redirect the homepage old.com to new.com right?


#6

Yes. The $2 also matches a blank path, such as the home page.


#7

Thank you very much


#8

Hi, just wondering, do we need end the url with a / ?

also do we redirect to http or https if we have the always use https checked?


#9

In the Page Rule, that does sound like a good idea to put a / between the domain and the * (I think the Page Rule engine autocorrects this on its own).

Redirect it to https to save some time so visitors don’t need to go through the “Always Use HTTPS” redirect.