0

This thread works as expected.

I have a question if it's possible to remove mypage.

The following also works, but now every page is going to mypage.

add_rewrite_rule(
        '^([^/]+)/?',
        'index.php?pagename=mypage&mycustomvar=$matches[1]',
        'top'
    );

What I want to achieve is(don't know if is possible due to WP index.php rule), that if I have a URL like mysite.host/mypage/?mycustomvar=test+by+wp&mycustomvar2=logs rewrite to mysite.host/test+by+wp-logs.

User sees this in the browser, mysite.host/test+by+wp-logs.

Any pointer in the right direction is appreciated.

1
  • I have used ^([^/]+)/([^/]+) to create a dynamic query string, even though it is not directly the solution to it but so far it is working.
    – TheBanjir
    Mar 17 at 14:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.