title: Custom nice URL in Wordpress
body: <p>I have URL like <code>mywebsite.com/media/cards/?name=something</code> and I want to make nice URL for it like <code>mywebsite.com/media/cards/something</code>? How can I do that?</p>
  
  <p>I've tried normal htaccess rewrite and wordpress <code>add_rewrite_rule</code>. None of it works.</p>
  
  <p>My example:</p>
  
  <pre><code>function custom_rewrite_rule() {
      $rule = '^media/cards/(.*)/';
      $write = 'media/cards/?name=$matches[1]';
      add_rewrite_rule($rule, $write, 'top');
  }
  add_action( 'custom', 'custom_rewrite_rule' );
  </code></pre>