I am trying to trim my urls using htaccess when my index.php acts like a key with the following code:
RewriteEngine on RewriteRule ^([^/]+)$ index.php?city=$1 [NC]
To use this in my area, just add the following to work on mysite.com/members/index.php?city=$1
RewriteRule ^members/([^/]+)$ index.php?city=$1 [NC]
in the case of a city that has a few words, that is: the city of New York, what is the best way to approach this? defining it in .htaccess (not sure if possible) to change the city of New York โ New York City or virtually any dash space. Or, do it in php with a function to replace '' โ '-' for db requests that use $ _GET?
source share