How can I redirect a specific URL path to another URL using a Cloudflare Page Rule managed by Terraform?

Responsive Ad Header

Question

Grade: Education Subject: Support
How can I redirect a specific URL path to another URL using a Cloudflare Page Rule managed by Terraform?
Asked by:
104 Viewed 104 Answers

Answer (104)

Best Answer
(276)
Use the `actions` block with the `action` set to `redirect`. You'll need to specify the `location` (the destination URL) and `type` (usually `permanent` or `temporary`). Example: `action { type = "redirect"; location = "https://www.example.com/new-page"; status_code = 301 }`