title: WordPress: rewrite rule with wildcard categories
body: <p>I've been browsing through the <a href="https://codex.wordpress.org/Rewrite_API/add_rewrite_rule" rel="nofollow noreferrer">Rewrite_API for WordPress and add_rewrite_rule documentation</a>, trying to find a way to rewrite a type of URL's that a have on a football team's website.</p>
  
  <p>The URL should look like this:</p>
  
  <p><code>domain.com/match/[season]/[title-of-post]/?type=something</code></p>
  
  <p>and I want this to redirect to:</p>
  
  <p><code>domain.com/match/[season]/[title-of-post]/something/</code></p>
  
  <p>Example: domain.com/match/premier-league-2018/chelsea-everton/something/</p>
  
  <p>I thought this would be possible through something like this, but I soon realized that the <code>(.*?)</code> are parsed as match queries:</p>
  
  <pre><code>function match_rewrite() {
      global $wp_rewrite;
      $wp_rewrite-&gt;add_rule( '^match/(.*?)/(.*?)/?$', 'index.php?type=$matches[1]', 'top' );
  }
  add_action('init', 'match_rewrite', 10, 0);
  </code></pre>
  
  <p>Thanks in advance!</p>