 <p>You can get both like this:</p> <pre><code>RewriteRule ^([A-Za-z-0-9-]+)/([A-Za-z0-9-]+)/?$ $1/$2?param1=$2 RewriteRule ^([A-Za-z-0-9-]+)/([A-Za-z0-9-/]+)/?$ $1.php?param=$2 [L,QSA] </code></pre> <p>The other thing is your second grouping in your second rule won't match a trailing slash because <code>([A-Za-z0-9-/]+)</code> is greedy and will gobble up a trailing slash. You can make it ungreedy by adding a <code>?</code>: <code>([A-Za-z0-9-/]+?)</code></p>