Home / Docs / RediRL

RediRL

Redirect Rule Language 1.0 — conditional redirect rules as text. Growth+ Rules library.

RediRL (Redirect Rule Language) is lit.onl’s line-oriented language for conditional redirects. It compiles to the same RuleSet used by the Flow editor. Growth+ can edit, export, and import .redirl files from the dashboard Rules library.

Quick example

device = desktop and country in US,CA -> https://example.com/na-desktop
os = android -> https://play.google.com/store/apps
device = mobile && country in BR then https://br.example.com/
country in CN -> mirror https://a.example/app token "secret" check both else https://fallback.example/

Syntax essentials

  • One branch per line ending with -> or then; blank lines ignored.
  • Comments: a line whose first non-space character is # (except file headers below).
  • Booleans: and / or / not (also && / || / !) with parentheses. Format in the editor rewrites to words + ->.
  • Premium mirrors: mirror … [token "…"] [check …] else https://fallback — see Mirror availability.
  • = means equal; != means not equal; in / nin take comma-separated lists.

Precedence

not binds tighter than and; and binds tighter than or. Use parentheses to override.

Fields and operators

FieldTypical opsValue
deviceeq, indesktop · mobile · tablet · …
oseq, inios · android · windows · macos · …
browsereq, inchrome · safari · firefox · …
browser_versioneq, lt, lte, gt, gtestring or number
countryin, nin, eqISO 3166-1 alpha-2 (e.g. US, DE)
ipeq, inIP or CIDR
languageeq, inBCP 47 / primary subtag
referrer_hosteq, inhostname
queryeq, inquery param presence / value
weekdayeq, in0–6 (UTC)
hour_utceq, lt, lte, gt, gte0–23
is_boteqtrue · false

How matching works

At redirect time, branches are tried in order. The first matching condition wins; otherwise the short link’s default destination URL is used.

Limits

LimitValue
Branches per set50
AST depth6
Leaves per branch40

.redirl files

UTF-8 text. Optional headers only at the top of the file:

# redirl: 1
# name: NA desktop vs Android store
device = desktop and country in US,CA -> https://example.com/na-desktop
os = android -> https://play.google.com/store/apps

Version header must be # redirl: 1. Export from the Rules library always emits that header and may include # name:.

Mapping to RuleSet JSON

RediRL:

device = desktop and country in US,CA -> https://example.com/na-desktop

compiles to:

{
  "v": 1,
  "rules": [
    {
      "id": "redirl-1",
      "when": {
        "all": [
          { "field": "device", "op": "eq", "value": "desktop" },
          { "field": "country", "op": "in", "value": ["US", "CA"] }
        ]
      },
      "url": "https://example.com/na-desktop"
    }
  ]
}

API

JSON field redirl on redirect rule sets. Export: GET /v1/redirect-rule-sets/{id}/export. Import: POST /v1/redirect-rule-sets/import. Interactive reference: API.

Related

Mirror availability · Bulk CSV column redirl · AI / MCP