Skip to content

Instantly share code, notes, and snippets.

@zakirsajib
Last active April 20, 2022 09:09
Show Gist options
  • Save zakirsajib/3f3e7627feb3c47db8eff3a4fe853ee5 to your computer and use it in GitHub Desktop.
Save zakirsajib/3f3e7627feb3c47db8eff3a4fe853ee5 to your computer and use it in GitHub Desktop.
Redirect one domain to another domain in cloudflare

First both domains must be within cloudflare. Both domains Nameservers must be changed to cloudflare's nameservers.

  1. Then login to first domain cludflare DNS dashboard. Lets say our first domain is hublearn.dk

  2. click Add Record

  3. Select Type A, In Name field, enter: hublearn.dk and in IPV4 address, add: 192.0.2.1. Save.

  4. Again Click Add Record

  5. Select Type A, In Name field, enter: www and in IPv4 address, type: 192.0.2.1. Save.

  6. Make sure both field has proxy status: Proxied and TTL auto set.

  7. Now go to Page Rules tab.

  8. Click Create Page Rule button.

  9. In URL field: enter: hublearn.dk/

  10. In Pick a Setting option, select Forwarding URL and set 301 or 302.

  11. And in Enter destination URL field, enter: https://www.hublearn.com/ which is your second domain name.

  12. Click Save Page Rule.

Now if you type hublearn.dk in your browser URL, it will redirect to https://www.hublearn.com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment