# if the "ugly" URL is used, force a redirect to the "pretty" URL
RewriteCond %{QUERY_STRING} tab=1 [NC]
RewriteCond %{QUERY_STRING} catid=7 [NC]
RewriteCond %{QUERY_STRING} subid=77 [NC]
RewriteRule /?directory/pageview.aspx http://mydomain.com/directory/merchant-accounts [R=301]

# if the "pretty" URL is detected, internally rewrite it to be useful
RewriteRule /?directory/merchant-accounts /directory/pageview.aspx?tab=1&catid=7&subid=77 [NC,QSA]