The following two functions should point you in the right direction:
function wpse49393_query_vars($query_vars)
{
$query_vars[] = 'myvar';
return $query_vars;
}
add_filter('query_vars', 'wpse49393_query_vars');
function wpse49393_rewrite_rules_array($rewrite_rules)
{
$rewrite_rules['path/to/page/([^/]+)/?$'] = 'index.php?pagename=path/to/page&myvar=$matches[1]';
return $rewrite_rules;
}
add_filter('rewrite_rules_array', 'wpse49393_rewrite_rules_array');
I would give credit where it is due, but I cannot remember where I originally found this code. I just pulled this out of a project that I am currently working on. To use it, change myvar
to the name of your variable in the first function as well as here: &myvar=$matches[1]
. Change path/to/page/
to the actual path of your page at two locations in the second function.