I have an url like that http://localhost/leneufbreton/achat-immobilier-neuf/programme-neuf/?ville=brest and I want to transformed to that http://localhost/leneufbreton/achat-immobilier-neuf/programme-neuf/brest or that http://localhost/leneufbreton/achat-immobilier-neuf/programme-neuf-brest

I was trying to use add_rewrite_rule but nothing happend.
This is my code action that I used:

function custom_rewrite_basic() {
   add_rewrite_rule('^programme-neuf/([^/]*)/', 'programme-neuf/?ville=$matches[1]', 'top');

add_action('init', 'custom_rewrite_basic');

Any idea please ?.

Read more here: add_rewrite_rule not working in wordpress


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: