How to Redirect Traffic from One Domain to Another

What is the name of the domain?

davidvarghese.dev

What is the issue you’re encountering

Unable to Redirect Traffic from One Domain to Another

What steps have you taken to resolve the issue?

  1. I own 2 domains davidvarghese.dev and davidvarghese.net. I want to redirect all traffic from .dev (including subdomains) to .net.
  2. I have 3 sites on Cloudflare pages. They are using the subdomains (blog, notes and tracker)
  3. I have a page redirect that sends traffic from davidvarghese.dev to blog.davidvarghese.dev.
  4. I also have bulk redirects setup to redirect from the pages.dev domains to by my .dev domain

What feature, service or problem is this related to?

DNS records

What are the steps to reproduce the issue?

  1. I would I get requests from the .dev domain to redirect to .net
  2. I also want requests to davidvarghese.dev to be redirected to blog.davidvarghese.net
  3. And requests to the .pages.dev URLs should also go to the .net domain

I think I have managed to figure it out. These are the changes I had to make:

  1. Removed the .dev custom domains configured in Pages and replaced then with the equivalent URL on the .net domain.
  2. Changed the Bulk Redirect rules to forward the .pages.dev requests to .net.
  3. Moved all the DNS entries (if any present) on the .dev domain DNS to the .net domain DNS.
  4. Added 2 A records in the DNS for .dev, one where the source is * and the other where the source is @ and I had them point to 192.0.2.1. (For subdomain redirect the * entry is required).
  5. Added a Page Rule in .dev domain to redirect *.davidvarghese.dev/* to https://$1.davidvarghese.net/$2

I also needed to add 2 Bulk Redirects to redirect www. to blog. and finally a Page Redirect for davidvarghese.net to blog.davidvarghese.net but these where configuration which was more specific to my deployment.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.