I have a main page and beyond that it has children. I successfully rewrite the children like so:
add_rewrite_rule('my-url/?([^/]*)', 'index.php?my-var=$matches', 'top');
This works great. But when I try to rewrite the base:
add_rewrite_rule('my-url/?', 'index.php?my-var=main', 'top');
... it doesn't work. I know, it's getting rewritten by the first rule, so I switched them around, but then the children were all getting redirected to the main page.
Is there a way to make the second rule strict so that it will only be effective if there is NOTHING after the "my-url/" ? This way I should be able to move it first, and all should work.
I have searched the net and found no solution. Maybe it's my terms, but I'm racking myself on this one. I hate regex! Shoot me if it's simple!