This is not how rewrite_rules
works in WordPress.
You miss two things.
- Match. It has
$1
, but in reality (take a look to example), you need to work with$matches
. - Your Query Var. You using
q
, but its not wp native or declared in example code. You can use one of the public ones or declare your query var and logic behind it. - If you are OK with Regular Expressions and already implemnt first two changes, but it still doesn’t work – I would suggest to use debug bar and my plugin debug bar rewrite rules