I am using wordpress and I have the following URL
http://www.example.com/product/sony-xperia/
What I am trying to achieve is if I add fr
after the base url like the example below, I want to display the same content as I can see for the url above.
http://www.example.com/fr/product/sony-xperia/
Could you please tell me how to achieve this?
I have managed to do it. I wrote the following piece of code in my function.php file and it worked.
function custom_rewrite_basic()
{
add_rewrite_rule('^fr/product/([^/]*)/?', 'index.php?product=$matches[1]', 'top');
}
add_action('init', 'custom_rewrite_basic');