You HAVE TO add a rewrite rule to WordPress. That can be done withou touching .htaccess. For example:
add_action('init', 'cyb_rewrite_rule');
function cyb_rewrite_rule() {
add_rewrite_rule( 'toto/([^/]+)/?$', 'index.php?pagename=$matches[1]', 'top' );
}
If you need access to the second part of the URL as query var, you can do this:
add_action('init', 'cyb_rewrite_rule');
function cyb_rewrite_rule() {
add_rewrite_rule( 'toto/([^/]+)/?$', 'index.php?pagename=$matches[1]&secondpart=$matches[2]', 'top' );
}
add_filter('query_vars', 'cyb_add_vars');
function cyb_add_vars($vars) {
$vars[] = 'secondpart';
return $vars;
}
Now “secondpart” is available in the query vars pool and you can access to it using WordPress funcions. For example, imaging you have this URL: “mysite.com/toto/apple”
if( get_query_var( "secondpart" == "apple" ) ) {
//It matchs
}