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 ?.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.