How to write correct add_rewrite_rule in WordPress for more than one taxonomy in one rule?

Changed URL formats to be like: /services/home-care/COUNTY/TOWN add_rewrite_rule( ‘services/([^/]*)/([^/]*)/([^/]*)/?’, ‘index.php?post_type=”ag_location”&ag_primary_inspection_cat=$matches[1]&ag_cities=$matches[3]’, ‘top’ ); add_rewrite_rule( ‘services/([^/]*)/([^/]*)/?’, ‘index.php?post_type=”ag_location”&ag_primary_inspection_cat=$matches[1]&ag_county=$matches[2]’, ‘top’ ); add_rewrite_rule( ‘services/([^/]*)/?’, ‘index.php?post_type=”ag_location”&ag_primary_inspection_cat=$matches[1]’, ‘top’ ); Based on this solution

Add filename to attachment page url

This doesn’t require a WordPress modification per se, but if you prefer to do it that way, here is a decent tutorial: http://shibashake.com/wordpress-theme/wordpress-page-redirect. Some people would, however, prefer to do this via the .htaccess file, here is a quick guide on how to do redirects that way: http://perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/#red1.