RewriteCond TestString CondPattern [flags] guards the next RewriteRule only. Conditions are ANDed, [OR] joins one to the next, [NC] ignores case, and they run only if the rule's pattern matched. The test string is usually a variable (Server Variables). The condition pattern is a regex (! negates); a file test (-f file, -d directory, -s non-empty, -l symlink, -x executable, -F and -U via a slow subrequest); a lexical (=, <, >=) or integer (-eq, -lt, -ge) comparison; or an ap_expr as expr "...". Comparisons take their operand with no space: -ge 2 reads as the pattern -ge with flags 2, and the file fails with RewriteCond: bad flag delimiters and a 500.
RewriteEngine On
RewriteCond %{QUERY_STRING} (?:^|&)id=(\d+)(?:&|$)
RewriteRule ^page$ show.php?page_id=%1 [L]
RewriteCond %{HTTP:X-Api-Version} -ge2
RewriteRule ^api/(.*)$ show.php?v=2&r=$1 [B,L]
RewriteRule ^api/(.*)$ show.php?v=1&r=$1 [B,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ show.php?front=1 [L]$ t '/page?x=1&id=7' /api/users /index.html /app /no/such/page
/page?x=1&id=7 200 {"page_id":"7"}
/api/users 200 {"v":"1","r":"users"}
/index.html 200
/app 301 http://example.com/app/
/no/such/page 200 {"front":"1"}
$ curl -s -H 'X-Api-Version: 3' localhost:8105/api/users | grep get
get: {"v":"2","r":"users"}%1 carried the id out of the query string wherever it sat. A missing header compares as an empty string, not at least 2. The real file and directory passed the front controller untouched (/app got mod_dir's trailing-slash redirect); Front-Controller Routing builds on this !-f/!-d pair.