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
->orthen; 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/nintake comma-separated lists.
Precedence
not binds tighter than and; and binds tighter than or. Use parentheses to override.
Fields and operators
| Field | Typical ops | Value |
|---|---|---|
device | eq, in | desktop · mobile · tablet · … |
os | eq, in | ios · android · windows · macos · … |
browser | eq, in | chrome · safari · firefox · … |
browser_version | eq, lt, lte, gt, gte | string or number |
country | in, nin, eq | ISO 3166-1 alpha-2 (e.g. US, DE) |
ip | eq, in | IP or CIDR |
language | eq, in | BCP 47 / primary subtag |
referrer_host | eq, in | hostname |
query | eq, in | query param presence / value |
weekday | eq, in | 0–6 (UTC) |
hour_utc | eq, lt, lte, gt, gte | 0–23 |
is_bot | eq | true · 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
| Limit | Value |
|---|---|
| Branches per set | 50 |
| AST depth | 6 |
| Leaves per branch | 40 |
.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