title: Can't rewrite product variation URL using add_rewrite_rule in WordPress
body: <p>I have an issue, I need to rewrite the variation slug for products in WooCommerce.
  For example, I have this URL:</p>
  <pre><code>http://localhost:8888/wordpress/product/wordpress-pennant/?attribute_pa_color=blue
  </code></pre>
  <p>What I need is this one:</p>
  <pre><code>http://localhost:8888/wordpress/product/wordpress-pennant/blue
  </code></pre>
  <p>I tried this code, but it doesn't work:</p>
  <pre><code>add_action( 'init', 'add_rewrite_rules' );
  function add_rewrite_rules() {
      add_rewrite_rule(
          '^product/([^/]*)?',
          'index.php?product=$matches[1]&amp;attribute_pa_color=$matches[2]',
          'top'
      );
      add_rewrite_tag('%attribute_pa_color%', '([^&amp;]+)');
  }
  </code></pre>
  <p>I can't understand what I'm doing wrong, I also made flush for permalinks.</p>