I've been struggling with this for two days right now. At the moment I have the following rewrite rule:\[code\]RewriteRule ^(.*)$ index.php?u=$1 [NC,L]\[/code\]Which ports everything behind example.com/ to index.php as the GET variable u. Which is being processed in index.php with an explode to define te different arguments being: the city (between the first slashes) en the location (the second argument)THis works perfectly for the following urls:example.com/City/location/ or example.com/City/location
example.com/City/ or example.com/CityWhich produces: \[code\]$arg[0] = city$arg[1] = location\[/code\]The problem happens when the location has an Ampersand in the location name:\[code\]example.com/city/location&more\[/code\]translates to:\[code\]index.php?u=city/location&more\[/code\]The problem is obvious; i can't use the explode parameter in index.php anymore because the second part of the location name is not stored in $_GET['u'].How can i solve this?I think of three solutions which i don't know how to implement:
1) rewriting the rewrite rule to split the city and location in the .htaccess
2) using a .htaccess equivalent of urlencode to transform the &-sign to %26
3) a complete other solution
Thanx in advance!EditFirstly:When the link is being produced by my website it gets translated with urlencode. So there isn't a & where there shouldn't be one. The & is part of a business namen like: "Bagels&Beans"When people want to search that company they type: www.example.com/city/bagels&beans in the url-field. ANd that is where the problem starts.edit 2When i go to: example.com/city/bagels%26Beansit translates to the following: $_GET:\[code\]Array( => city/Bagels [Beans] => )\[/code\]edit 3The way i explode the $_GET['u'] to form the arguments.\[code\]$arg = explode('/',$_GET['u']);\[/code\]
example.com/City/ or example.com/CityWhich produces: \[code\]$arg[0] = city$arg[1] = location\[/code\]The problem happens when the location has an Ampersand in the location name:\[code\]example.com/city/location&more\[/code\]translates to:\[code\]index.php?u=city/location&more\[/code\]The problem is obvious; i can't use the explode parameter in index.php anymore because the second part of the location name is not stored in $_GET['u'].How can i solve this?I think of three solutions which i don't know how to implement:
1) rewriting the rewrite rule to split the city and location in the .htaccess
2) using a .htaccess equivalent of urlencode to transform the &-sign to %26
3) a complete other solution
Thanx in advance!EditFirstly:When the link is being produced by my website it gets translated with urlencode. So there isn't a & where there shouldn't be one. The & is part of a business namen like: "Bagels&Beans"When people want to search that company they type: www.example.com/city/bagels&beans in the url-field. ANd that is where the problem starts.edit 2When i go to: example.com/city/bagels%26Beansit translates to the following: $_GET:\[code\]Array( => city/Bagels [Beans] => )\[/code\]edit 3The way i explode the $_GET['u'] to form the arguments.\[code\]$arg = explode('/',$_GET['u']);\[/code\]