I have a search form to search for a health institution in a city. when I display the results I have this URL for example : search.php?city=mycity&speciality=cardiology
I would like to rewrite this URL like this: health-institution-cardiology-mycity
I set up an htaccess rule like this :
RewriteEngine on
RewriteRule health-entity-([a-zA-Z\-] )-([a-zA-Z\-] ) search.php?city=$2&speciality=$1
It doesn't work, however, I applied this rule to another type of URL and it works
is there any issue with the code? do I need to add something?
CodePudding user response:
This will work:
RewriteEngine on
RewriteRule ^health-institution-([a-z] )-([a-z] )/?$ search.php?city=$2&speciality=$1 [NC,L]
Note: The NC (No Case) at the end makes the rurl case insensitive.