github.com/StackExchange/dnscontrol/v4@v4.11.0/documentation/language-reference/domain-modifiers/CF_REDIRECT.md (about)

     1  ---
     2  name: CF_REDIRECT
     3  parameters:
     4    - source
     5    - destination
     6    - modifiers...
     7  provider: CLOUDFLAREAPI
     8  parameter_types:
     9    source: string
    10    destination: string
    11    "modifiers...": RecordModifier[]
    12  ---
    13  
    14  `CF_REDIRECT` uses Cloudflare-specific features ("Forwarding URL" Page Rules) to
    15  generate a HTTP 301 permanent redirect.
    16  
    17  If _any_ `CF_REDIRECT` or [`CF_TEMP_REDIRECT`](CF_TEMP_REDIRECT.md) functions are used then
    18  `dnscontrol` will manage _all_ "Forwarding URL" type Page Rules for the domain.
    19  Page Rule types other than "Forwarding URL” will be left alone.
    20  
    21  {% hint style="warning" %}
    22  **WARNING**: Cloudflare does not currently fully document the Page Rules API and
    23  this interface is not extensively tested. Take precautions such as making
    24  backups and manually verifying `dnscontrol preview` output before running
    25  `dnscontrol push`. This is especially true when mixing Page Rules that are
    26  managed by DNSControl and those that aren't.
    27  {% endhint %}
    28  
    29  HTTP 301 redirects are cached by browsers forever, usually ignoring any TTLs or
    30  other cache invalidation techniques. It should be used with great care. We
    31  suggest using a `CF_TEMP_REDIRECT` initially, then changing to a `CF_REDIRECT`
    32  only after sufficient time has elapsed to prove this is what you really want.
    33  
    34  This example redirects the bare (aka apex, or naked) domain to www:
    35  
    36  {% code title="dnsconfig.js" %}
    37  ```javascript
    38  D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
    39    CF_REDIRECT("example.com/*", "https://www.example.com/$1"),
    40  END);
    41  ```
    42  {% endcode %}