Let’s start by getting rid of the rules you’ve added to your .htaccess
. This is WPSE and the page is running inside of WordPress, so we’re going to rely on WP to do the rewriting.
You’re going to want to register CD_Produit
as a query variable so WordPress’ front controller is aware of it.
function wpse427745_add_query_vars($vars) {
$vars[] = 'CD_Produit';
return $vars;
}
add_filter('query_vars', 'wpse427745_add_query_vars');
Next you need to add the rewrite:
function wpse427745_add_rewrite_rule($rules) {
$new_rules = array('CD_Produit/([^/]+)/?$' => 'index.php?pagename=products&CD_Produit=$matches[1]');
$rules = $new_rules + $rules;
return $rules;
}
add_filter('rewrite_rules_array', 'wpse427745_add_rewrite_rules');
Visit Settings > Permalinks and hit “Save Changes” (which refreshes all permalinks, not just the ones listed on the Settings page) and you should be good to go.