Trouble with question mark in rewrite rule

The root problem here is a misunderstanding of how URLs work. What you see in the browser is not a full URL, but something to make it easier to understand

For example, take this URL:

http://example.com/test/?foo=bar#bananas

Here we have instructions to:

  • Via HTTP protocol aka http://
  • contact the server at example.com aka https://example.com
  • and do a GET HTTP request for /test/ aka https://example.com/test/
  • With the parameters foo=bar aka https://example.com/test/?foo=bar

WP Rewrite rules operate on the request, aka the /test/, so you can never match ?foo=bar part of a URL. The GET parameter foo gets put inside the $_GET array. Note how the # component is never sent, this part of the address is entirely client side.

So in order for your test to work, you will need to do two things:

  • Match on to the /something/something-else/also-different-1030/ part
  • Then check $_GET['success'] to see if it has a valid value