Set up redirects for your domain

Create automatic redirects from one URL to another for your domain. This is useful when changing website addresses or directing visitors to a new page. Returns an ID needed to manage or verify the redirect in subsequent calls.

Headers

Accept Example
Content-Type Example

Body

required
application/json
domain_id string required
domain_name string required
source_url string required
target_url string required
status_code integer required
redirect_scope string · enum required
all
exact
root_www
preserve_query_string boolean required
include_subdomains boolean required
subpath_matching boolean required
description string required

Responses

200
success boolean
timestamp string
requestId string
data object
400
error string
message string
code string
timestamp string
requestId string
409
error string
message string
code string
timestamp string
requestId string
500
error string
message string
code string
timestamp string
requestId string
POST https://cloud.hostup.se/api/redirects
For AI assistants
cURL
curl -X POST "https://cloud.hostup.se/api/redirects" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "domain_id": "string",
    "domain_name": "string",
    "source_url": "string",
    "target_url": "string",
    "status_code": 0,
    "redirect_scope": "all",
    "preserve_query_string": true,
    "include_subdomains": true,
    "subpath_matching": true,
    "description": "string"
  }'
Response
{
  "success": true,
  "timestamp": "string",
  "requestId": "string",
  "data": {
    "rule": {
      "id": 0,
      "domain_id": 0,
      "domain_name": "string",
      "cloudflare_zone_id": "string",
      "cloudflare_ruleset_id": "string",
      "cloudflare_rule_id": "string",
      "source_url": "string",
      "target_url": "string",
      "status_code": 0,
      "preserve_query_string": true,
      "include_subdomains": true,
      "preserve_path_suffix": true,
      "subpath_matching": true,
      "description": "string",
      "enabled": true,
      "created_at": "string",
      "updated_at": "string",
      "created_by": 0,
      "redirect_scope": "string"
    }
  }
}
Request Body
{
  "domain_id": "string",
  "domain_name": "string",
  "source_url": "string",
  "target_url": "string",
  "status_code": 0,
  "redirect_scope": "all",
  "preserve_query_string": true,
  "include_subdomains": true,
  "subpath_matching": true,
  "description": "string"
}