Hey guys, I had read a lot of articles, guides & tips and still cant understand how to rewrite rule.
Here is what i got:
my url:
http://localhost/wordpress/?navopt=main
my code in functions.php:
/*
* Add rewrite tags
*/
function add_new_rewrite_tags() {
add_rewrite_tag(
'%index%',
'([^/]*)' ) ;
}
add_action( 'register_special_query_vars', 'add_new_rewrite_tags' ); /*hooked to a previous function which gets vars from the url.*/
/*
* Rewriting rules
*/
function query_rewrite_new_rules() {
add_rewrite_rule(
'^/([^/]*)',
'?navopt=$matches[1]',
'top' );
}
add_action( 'add_new_rewrite_tags', 'query_rewrite_new_rules');