I’ve added a querystring var to wordpress like this and now I need to change the notation from ? to slashes, so these
http://example.com/myweb/page-1/?param=value
http://example.com/myweb/page-2/?param=value
http://example.com/myweb/page-3/?param2=value
appear like this:
http://example.com/myweb/page-1/param/value
http://example.com/myweb/page-2/param/value
http://example.com/myweb/page-3/param2/value
I tried in .htaccess with no luck and saw this post explaining it but I can’t take it to work, I’m bad at regular expressions and this particular example is diffuclt to debug, so I’d appreciate some help.
This is my code:
function add_rewrite_rules($aRules)
{
$aNewRules = array('page-1/([^/]+)/?$' => 'index.php?pagename=page-1¶m=$matches[1]');
//ALso tried $aNewRules = array('myweb/page-1/([^/]+)/?$' => 'myweb/index.php?pagename=page-1¶m=$matches[1]');
$aRules = $aNewRules + $aRules;
return $aRules;
}
// hook add_rewrite_rules function into rewrite_rules_array
add_filter('rewrite_rules_array', 'add_rewrite_rules');
Thank you