Ben şu anda iki gün boyunca bu mücadele ettik.
Şu anda ben aşağıdaki yeniden yazma kuralı vardır:
RewriteRule ^(.*)$ index.php?u=$1 [NC,L]
Hangi GET değişkeni u gibi index.php example.com / arkasında bağlantı noktaları her şey. Ile index.php işleniyor hangi bir varlık te farklı argümanları tanımlamak için patlayabilir: konuma tr (ilk bölü arasında) şehir (ikinci argüman)
THis aşağıdaki URL'ler için mükemmel çalışıyor:
example.com/City/location/ or example.com/City/location
example.com/City/ or example.com/City
Üretir:
$arg[0] = city
$arg[1] = location
Konum konum adına bir Ampersand olduğunda sorun olmuyor:
example.com/city/location&more
çevirir:
index.php?u=city/location&more
Sorun açıktır; yer adının ikinci bölümü $ _GET ['u'] saklı değildir çünkü ben artık index.php patlayabilir parametresini kullanamazsınız.
I bu nasıl çözebilir?
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!
Edit Firstly: 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 2 When i go to: example.com/city/bagels%26Beans it translates to the following: $_GET:
Array
(
[u] => city/Bagels
[Beans] =>
)
edit 3 The way i explode the $_GET['u'] to form the arguments.
$arg = explode('/',$_GET['u']);