Path-parameter boundary lab · Updated November 14, 2026
Encode Semicolon Matrix Parameters in a URL Path
A semicolon in a path can be a matrix-parameter delimiter, while a semicolon inside a value is data. Decide which role it has before encoding; encoding the whole path blindly can erase the boundary your router expects.
Three delimiters, three jobs
| Location | Example | Observed boundary |
|---|---|---|
| Path matrix parameters | /items;color=red;size=large | Semicolons may separate parameters inside a path segment. |
| Query separator | ?color=red&size=large | Ampersand separates query pairs, not path segments. |
| Value data | ?note=a%3Bb | An encoded semicolon stays inside the value. |
Node and PHP measured output
Run date: November 14, 2026. Node.js v24.19.0 and PHP 8.5.12 preserve the semicolon in the path string; neither API automatically defines your router's matrix-parameter policy.
Node.js v24.19.0 → pathname /items;color=red;size=large, search ?note=a;bPHP 8.5.12 parse_url → path /items;color=red;size=large, query note=a;b
Common failure
Do not use query encoding rules to rewrite an entire path segment. Encode a value such as red;blue as red%3Bblue when it is data, but keep a router's structural semicolons only when that router documents matrix parameters.
FAQ
Are matrix parameters universal?
No. They are a path convention, not a requirement of every web framework. Test the actual router before relying on them.
Should I encode every semicolon?
Only semicolons that belong to data. Structural delimiters and data values must be separated deliberately.
For URL parts, use URL Format. For query states, use Query Parameters.