Thursday, March 5, 2015

Forwarding a Domain Name to a New Domain Using Cloudflare

Cloudflare Logo

Lately, I moved my domain names to namesilo, and I noticed that their domain forwarding option will only forward the root domain, rather than all the pages or virtual directories within that domain.

I decided to park my DNS on cloudflare since it's for free and forward the domain and all its pages to the new domain name.

First, add CNAME records to point to the domain you want, in my case I'm pointing my old domain name to www.tech-and-dev.com. for example:
Adding CNAME from old domain to new domain in cloudflare

and if you want to forward the www version too, add another CNAME with www:
Adding CNAME from old domain to new domain in cloudflare

After adding the CNAMES, make sure to tick the cloud button:

Save the DNS records, and go back to the Websites list, and click on the settings icon next to the domain name, and choose "Page Rules".
Cloudflare Page Rules
Turn Forwarding On and enter the first rule:


In the above screenshot, I'm forwarding myolddomain.com to this domain (www.tech-and-dev.com) and forwarding all the virtual directories of that domain.
The asterisk * in the pattern URL will match any text entered after the domain name and can be used in the Forwarding URL. First asterisk will be $1, 2nd asterisk $2....

If you want to forward www.myolddomain.com to the same domain, create another similar rule but with www:



That's it! Any comments? Please post them below!