I have a site http://hitplayyoga.com and we have a studio directory on that site. It lists all the studios in our system. We are writing the URL link to the studio like this right now:
http://hitplayyoga.com/studio-detail/69
and that will properly display the details for the studio with the ID of 69. We want to change the URL so that it includes the studio name. It should either be
http://hitplayyoga.com/studio-detail/69/3-Oms-Yoga
-or-
http://hitplayyoga.com/studio-detail/3-Oms-Yoga
How can I write a rule in .htaccess that will redirect the page to studio-detail/?id=$1&name=$2 if I include the ID or studio-detail/?name=$2 if I do not include the ID? I am a newbie at .htaccess files and rewrite rules. Thanks for your help!
You should keep ID in the URL. This is the rule that should work for you: