Skip to content
Cloudflare Docs

Redirect requests for a domain to a new domain

Create a redirect rule to redirect all URLs for a domain to point to the root of a new domain, including any subdomains of the old domain.

In this example, an old website was discontinued and replaced by a new one in a different domain. The functionality is different, and all URLs should now point to the root of the new domain. The same applies to any subdomains of the old domain.

Create a redirect rule with the following configuration:

When incoming requests match

  • Wildcard pattern
    • Request URL: http*://*example.com/*

Then

  • Target URL: https://example.net/
  • Status code: 301

For example, the redirect rule would perform the following redirects:

Request URLTarget URLStatus code
http://example.com/https://example.net/301
https://example.com/https://example.net/301
https://subdomain.example.com/https://example.net/301
https://example.com/my/path/to/page.htmhttps://example.net/301
https://example.com/search?q=termhttps://example.net/301