Forum Moderators: phranque
selectedCity can be either a country OR a city - I use php to determine which it is, and respond appropriately.
My mod_rewrite rule turns
www.mysite.com/destinations/Madrid
into
www.mysite.com/articles.php?selectedCity=Madrid
if I use lowercase for the city, it works fine as well:
www.mysite.com/articles.php?selectedCity=madrid
The problem is when I try and use the country as lowercase:
www.mysite.com/articles.php?selectedCity=spain
my variable is not parsed by the database. Using uppercase Spain works.
Here is my code:
RewriteRule ^destinations/([a-zA-Z]*)$ /articles.php?selectedCity=$1 [L]
RewriteRule ^destinations/([a-zA-Z]*)/([a-zA-Z]*)$ /articles.php?theCountry=$1&selectedCity=$2 [L]
RewriteRule ^destinations/([a-zA-Z]*)/([a-zA-Z]*)/([0-9]*)\.html$ /read.php?theCountry=$1&theCity=$2&aid=$3 [L]
Just a note, the variables 'theCountry' and 'theCity' are dummies - they aren't actually parsed to the database...
Any help appreciated.
Gordon
Welcome to WebmasterWorld!
Since all your RewriteRules are identical in form, that's a good hint that the problem is not in mod_rewrite, but in your script. I suspect you'll find that cities are checked for case and fixed-up if needed, while countries are not. Or it could be the form of the database lookup call -- case-sensitive lookup versus case-insensitive. I'm not sure, since I don't know any of these details.
But either way, it's a lot easier to do case-conversion in PHP than in mod_rewrite! :)
Jim