• Resolved tiptap

    (@tiptap)


    I have a url structure for my custom taxonomy called ‘feature’ in the format;

    http://www.mysite.com/feature/term/child-term/

    What I’m trying to do is add a rewrite to the beginning to allow me to prefix a set of values (asia|europe|africa).

    So that a request to;

    http://www.mysite.com/asia/feature/term/child-term/

    would translate the url back to the url at the top, then add asia to the query var.

    I’ve written a rewrite that does seems to do it when i test in a regex tester, however its causing a redirection error in the browser

    add_rewrite_rule('^(europe|asia|africa)/([^/]+/)*([^/]+)/?','index.php?feature=$matches[3]&prefix=$matches[1]','top');

    ie it should go to; index.php?feature=term-name&prefix=asia

    Perhaps I’m missing something but this has me stumped

    Any help appreciated

Viewing 1 replies (of 1 total)
  • Thread Starter tiptap

    (@tiptap)

    Ok I managed to solve it.

    It seemed the place I was added the rewrite rule kept getting removed. so I moved it to the INIT hook and all seems fine.

    Also it seemed to be caching a lot of the pages so I cleared that also and is now fine.

    I noticed it the rewrite was getting removed by installing the ‘Monkeyman Rewrite Analyzer’ plugin which lists all of them.

Viewing 1 replies (of 1 total)
  • The topic ‘add_rewrite_rule causing redirection problem’ is closed to new replies.