我正在使用wordpress,我有以下URL
http://www.example.com/product/sony-xperia/我试图实现的是,如果我像下面的例子一样在基本url之后添加fr,我希望显示与上面的url相同的内容。
http://www.example.com/fr/product/sony-xperia/你能告诉我如何做到这一点吗?
发布于 2017-04-24 16:30:03
我已经设法做到了。我在我的function.php文件中写了下面这段代码,它可以工作。
function custom_rewrite_basic()
{
add_rewrite_rule('^fr/product/([^/]*)/?', 'index.php?product=$matches[1]', 'top');
}
add_action('init', 'custom_rewrite_basic');https://stackoverflow.com/questions/43572618
复制相似问题