Reputation: 59
I spend few hours thinking under one problem.
I making frendly url for some application, and it works fine with this cond:
RewriteEngine On
RewriteRule ^/shop/([a-z]*)/([a-záéíóúüñç]*)-([a-záéíóúüñç]*)$ /carga.php?car=$3&model=$2&type=buy&lang=$1&other=$4 [QSA]
after that url loks like that:
example.com/shop/spanish/m3-bmw?other=somevar
but the main problem is that application must receive language in 2 letters format, for example, es,en,ru shortly speaking - somehow it must go from url to application in that format. Now i see that applicatin receives full word from url.
So at the moment url looks like that:
example.com/shop/spanish/m3-bmw?other=somevar
But application needs like that:
example.com/shop/es/m3-bmw?other=somevar
thank you in advance
Upvotes: 0
Views: 274
Reputation: 5546
According to what you say you want, you just need this:
RewriteEngine On
RewriteRule ^/shop/([a-z]{2})[a-z]*/([a-záéíóúüñç]*)-([a-záéíóúüñç]*)$ /carga.php?car=$3&model=$2&type=buy&lang=$1&other=$4 [QSA]
But I am not sure it can work for all languages if the language code is not the first 2 letters for instance.
Upvotes: 1