First both domains must be within cloudflare. Both domains Nameservers must be changed to cloudflare's nameservers.
-
Then login to first domain cludflare DNS dashboard. Lets say our first domain is hublearn.dk
-
click Add Record
-
Select Type A, In Name field, enter: hublearn.dk and in IPV4 address, add: 192.0.2.1. Save.
-
Again Click Add Record
-
Select Type A, In Name field, enter: www and in IPv4 address, type: 192.0.2.1. Save.
-
Make sure both field has proxy status: Proxied and TTL auto set.
-
Now go to Page Rules tab.
-
Click Create Page Rule button.
-
In URL field: enter: hublearn.dk/
-
In Pick a Setting option, select Forwarding URL and set 301 or 302.
-
And in Enter destination URL field, enter: https://www.hublearn.com/ which is your second domain name.
-
Click Save Page Rule.
Now if you type hublearn.dk in your browser URL, it will redirect to https://www.hublearn.com/