Example: redirect from old.com
to new.com
, and www.old.com
to www.new.com
- Go to
Rules / Redirect Rules
page - Create a new rule
- Select
Custom filter expression
- Add matching rules
- Field
Hostname
, operatorequals
, valueold.com
, or - Field
Hostname
, operatorequals
, valuewww.old.com
- Field
- Add URL redirect rule
- Type
Dynamic
, expressionconcat("https://www.new.com", http.request.uri.path)
, status code301
- Type
- Check
Preserve query string
- Click
Deploy
- Type
A
, name@
, content192.0.0.1
, enableProxy
- Type
A
, namewww
, content192.0.0.1
, enableProxy
The key is to enable Cloudflare proxy. The actual address for the content
field does not matter. Can also set up CNAME
records with arbitrary content
values.