Unable to forward/redirect a URL

I am trying to redirect/forward oldsite.com to newsite.com. When people visit oldsite.com the address bar and website should change to newsite.com with, ideally, all the url variables are parameters preserved - though that is not mandatory.

I have tried all the ways I know of doing it:

Single Redirect

  • Field: hostname
  • operator: contains
  • value: oldsite
  • type: static
  • url: https://newsite.com
  • status code: 301
  • preserve query string: checked

Bulk Redirect:

  • Source URL: oldsite.com/
  • Target URL: https://newsite.com
  • Status: 301
  • Edit parameters: preserve query string, include subdomains, subpath matching, checked

Page Rules:

I have tried all these separately and together, I have waited over 24 hours for them to propagate, I have purged cache, but still when I visit oldsite.com or www.oldsite.com I only get a “server not found” dead page.

I am not sure how to proceed or test where the issue is or why the connection is not happening. All suggestions welcome.

Thank you!

Since page rules will eventually be deprecated, I would use the newer redirect rules. Unless you need features in bulk redirects, I would use single redirect.

Is the hostname that you are trying to redirect set to :orange: Proxied in Cloudflare? Redirects only work on :orange: names.

Does the redirect destination work when requested directly?

You may want to use a 302 redirect until you have it working. It can be hard to test changes to your redirect when your browser has already been sent a 301 permanent redirect. Another option is to test with curl since it doesn’t cache redirects by default.

If you would like the community to examine your redirect, you can share the domain name here.

These are excellent questions, thank you.

Does the redirect destination work when requested directly?

Yes.

Is the hostname that you are trying to redirect set to :orange: Proxied in Cloudflare? Redirects only work on :orange: names.

This might be the issue. I don’t have any DNS setup except MX records. I am using Cloudflare Pages to host. Originally I had olddomain.com setup with Pages, then I deleted it from Pages and added newdomain.com, then setup the forward on olddomain.com. Was this the mistake? Should I re-add olddomain.com to Pages so that it has a proxied cname record?

1 Like

You don’t need the old domain in Cloudflare Pages, but you do need an :orange: hostname for it in Cloudflare DNS. I recommend creating only a AAAA record with the IP of 100::. That address is designated as the discard prefix, which makes it impossible to mistake for an active address on an external server.

1 Like

That worked! Thank you very much. I created a proxied AAAA DNS record at olddomain.com with the name @ and the content 100::

Much appreciated :+1:

1 Like

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