I don't know if it is possible to achieve this. I want to create custom rewrite rule to redirect an URL to other one.

For now, my URL is like :

/store-director/storeName-directoreName/

I want my URL to be like :

/store/storeName/directorName

I tryed something like this :

add_rewrite_rule('^store/([^/]*)/([^/]*)/?','store-director/$matches[1]-$matches[2]','top');

It doesn't work, it redirects to an other page...

  • You need to rewrite one url or multiple? – BenB Jun 30 '17 at 18:53
  • Multiple URL with dynamic storeName and directorName. – Vincent Decaux Jun 30 '17 at 18:54
  • How many urls? more than 1000? – BenB Jun 30 '17 at 18:55
  • Almost 50 URL to rewrite – Vincent Decaux Jun 30 '17 at 18:56
  • What is /storeName-directoreName/? Is that the slug of a page? – Milo Jun 30 '17 at 22:14

You could load a csv file to Simple 301 redirect plugin with the url's you want to rewrite. It's simple to use and works.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.