I'm developing a plugin, that should display content according to two optional parameters in the URL. The following URL should all be treated by the plugin: /pluginpage/ /pluginpage/value1/ /pluginpage/value1/value2/ Now I have put in place these things: - A page with a shortcode `[myplugin]` and the URL `/pluginpage/` - The shortcode that displays the content taking the parameters from the `$_GET` variable - The plugin works if the URL looks like `/pluginpage/?param1=value1¶m2=value2` - Two rewrite rules in place, that match the three URL patterns to the page with the shortcode ``` add_rewrite_rule('^(pluginpage)/(.*)/?', 'index.php?name=$matches[1]¶m1=$matches[2]', 'top'); add_rewrite_rule('^(pluginpage)/(.*)/(.*)/?', 'index.php?name=$matches[1]¶m1=$matches[2]¶m2=$matches[3]', 'top'); ``` The rewrite rules work, but not as expected. When navigating to `/pluginpage/value1/` or `/pluginpage/value1/value2/` the page with the shortcode is displayed, but there is a redirect to `/pluginpage/` and the parameters are lost during the redirect. There is a missing piece that tells wordpress to not redirect from `/pluginpage/value1/` to `/pluginpage/`. What exactly is missing? Or might there be a better approach by mapping the URLs directly to the plugin without using a page and a shortcode? [This question][1] is quite similar, but the answers are lacking important details, and therefore were not helpful in my case. Thank you for any help. [1]: https://wordpress.stackexchange.com/questions/7895/custom-path-for-a-plugin