我在wordpress like this添加了一个查询字符串var,现在我需要更改符号吗?斜线,所以这些
http://example.com/myweb/page-1/?param=value
http://example.com/myweb/page-2/?param=value
http://example.com/myweb/page-3/?param2=value
看起来像这样:
http://example.com/myweb/page-1/param/value
http://example.com/myweb/page-2/param/value
http://example.com/myweb/page-3/param2/value
我尝试了.htaccess没有运气,看到了this post explaining it但是我不能接受它的工作,我对正则表达式不好,这个特殊的例子很难调试,所以我很欣赏一些帮助
这是我的代码:
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');
谢谢