Rewrite rule issue
-
I have a site https://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:
https://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 behttps://hitplayyoga.com/studio-detail/69/3-Oms-Yoga
-or-
https://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&studio=$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!If I go to https://hitplayyoga.com/studio-detail/?id=69&studio=3-Oms-Yoga the page displays correctly, but this Rewrite Rule isn’t working:
RewriteRule ^studio-detail/([^/]*)/([^/]*)/?$ studio-detail/?id=$1&studio=$2 [L,QSA,NC]
Also, it appears that it is using the “3-Oms-Yoga” as a search term because if I change the url to be https://hitplayyoga.com/studio-details/93/a I get an “about us” page that displays.
Any ideas on how to make this work?
- The topic ‘Rewrite rule issue’ is closed to new replies.