A multi-language website with concrete5 and nginx
Having a website is fine but in several language it's better. To make a site which open in the right language for the visitor we'll use a bit of concrete5 logic and some nginx rewrite rules. The nginx5 rewrite rules could be made for whatever decent web server.
The idea is having as home page a page which asks the visitor for the language he wants and a subpage for every language we made a translation for. The home page will be used only if language detection failed. Such a page could be seen here.
When a browser wants to get a page it sends to the server the name of the page but also informations about his capabilities. One of this informations is what are the preferred languages. It's send in the accept_language header. We'll use it to write some nginx5 rewrite rules.
if ( $http_accept_language ~ ^(..) ) {
set $lang $1;
}
if ( $lang ~* fr ) {
rewrite ^(/|/index.php)$ /fr/;
}
if ( $lang ~* en ) {
rewrite ^(/|/index.php)$ /en/;
}
if ( $lang ~* es ) {
rewrite ^(/|/index.php)$ /es/;
}
Please note that we match on / and /index.php to avoid issues.
Et voilà! only thing to do is to adjust the depth of menus on the left to display only the menu for the current language.
How to have an internationalized website with concrete5 and nginx
Comments:
Posted by
Brian
on
2/04/2012 23:25:40
I find that using map it makes it a lot shorter and more readable:
map $http_accept_language $sublang {
default en;
~* fr fr;
~* es es;
}
rewrite ^(/|/index.php)$ /$sublang/;
Posted by
Christian
on
22/07/2014 14:56:00
Such an easy and great solution. Thanks a lot!!
Posted by
Janess
on
21/05/2016 09:29:35
It's good to get a fresh way of loionkg at it.
Posted by
Jaylon
on
21/05/2016 10:14:24
Inltcligenee and simplicity - easy to understand how you think.
Posted by
Spud
on
21/05/2016 13:37:21
Super inrvomatife writing; keep it up.
Posted by
Lucy
on
21/05/2016 13:39:20
This forum needed shnkiag up and you've just done that. Great post!
Posted by
Robbie
on
24/05/2016 00:25:59
Well I guess I don't have to spend the weekend fingirug this one out!
Posted by
Tori
on
24/05/2016 00:27:19
Great post with lots of imnpotart stuff.
Posted by
JamesClept
on
11/09/2017 13:51:36
Our team is a unique producer of quality fake documents.
We offer only original high-quality fake passports, driver's licenses, ID cards, stamps and other products for a number of countries like:
USA, Australia, Belgium, Brazil, Canada, Italy, Finland, France, Germany, Netherlands, Spain, United Kingdom. This list is not full.
To get the additional information and place the order just visit our website:
http://www.salepassportsfake.cc www. salepassportsfake.cc
>> Contact e-mails:
General support: support@salepassportsfake.cc
Technical support: admin@salepassportsfake.cc
-----------------------------
Keywords:
obtain fake passports,
obtain false passports,
obtain novelty passports,
obtain fake driver license,
obtain false driver license,
obtain novelty driver license,
obtain Diplomatic passports,
purchase fake passports,
purchase false passports,
purchase novelty passports,
purchase fake driver license,
purchase false driver license,
purchase novelty driver license,
purchase Diplomatic passports,
sell fake passports,
sell false passports,
sell novelty passports,
sell fake driver license,
sell false driver license,
sell novelty driver license,
get fake passports,
get false passports,
get novelty passports,
get fake driving license,
get false driving license,
get novelty driver license,
get Diplomatic passports
Posted by
dezidee
on
24/03/2019 21:56:22
d3d3Lmp1c3Rhc3lzYWRtaW4ubmV0 xehiirea-a.anchor.com [URL=http://theprettyguineapig.com/generic-cialis/#xehiirea-u]xehiirea-u.anchor.com[/URL] http://theprettyguineapig.com/generic-cialis/#xehiirea-t http://theprettyguineapig.com/generic-cialis/#xehiirea-t http://theprettyguineapig.com/generic-cialis/#xehiirea-t http://theprettyguineapig.com/generic-cialis/#xehiirea-t http://theprettyguineapig.com/generic-cialis/#xehiirea-t http://theprettyguineapig.com/generic-cialis/#xehiirea-t http://theprettyguineapig.com/generic-cialis/#xehiirea-t http://theprettyguineapig.com/generic-cialis/#xehiirea-t evaligohg
Posted by
awejileh
on
24/03/2019 21:56:26
d3d3Lmp1c3Rhc3lzYWRtaW4ubmV0 egucedi-a.anchor.com [URL=http://theprettyguineapig.com/generic-cialis/#egucedi-u]egucedi-u.anchor.com[/URL] http://theprettyguineapig.com/generic-cialis/#egucedi-t http://theprettyguineapig.com/generic-cialis/#egucedi-t http://theprettyguineapig.com/generic-cialis/#egucedi-t http://theprettyguineapig.com/generic-cialis/#egucedi-t http://theprettyguineapig.com/generic-cialis/#egucedi-t http://theprettyguineapig.com/generic-cialis/#egucedi-t http://theprettyguineapig.com/generic-cialis/#egucedi-t http://theprettyguineapig.com/generic-cialis/#egucedi-t ikaqum
Posted by
efzenasuq
on
24/03/2019 21:56:37
d3d3Lmp1c3Rhc3lzYWRtaW4ubmV0 oferobiy-a.anchor.com [URL=http://theprettyguineapig.com/generic-cialis/#oferobiy-u]oferobiy-u.anchor.com[/URL] http://theprettyguineapig.com/generic-cialis/#oferobiy-t http://theprettyguineapig.com/generic-cialis/#oferobiy-t http://theprettyguineapig.com/generic-cialis/#oferobiy-t http://theprettyguineapig.com/generic-cialis/#oferobiy-t http://theprettyguineapig.com/generic-cialis/#oferobiy-t http://theprettyguineapig.com/generic-cialis/#oferobiy-t http://theprettyguineapig.com/generic-cialis/#oferobiy-t http://theprettyguineapig.com/generic-cialis/#oferobiy-t odiwaf
Posted by
igadoluc
on
8/09/2019 00:14:16
d3d3Lmp1c3Rhc3lzYWRtaW4ubmV0 oqaqvi-a.anchor.com [URL=http://mewkid.net/order-cialis/#oqaqvi-u]oqaqvi-u.anchor.com[/URL] http://mewkid.net/order-cialis/#oqaqvi-t http://mewkid.net/order-cialis/#oqaqvi-t http://mewkid.net/order-cialis/#oqaqvi-t http://mewkid.net/order-cialis/#oqaqvi-t http://mewkid.net/order-cialis/#oqaqvi-t http://mewkid.net/order-cialis/#oqaqvi-t http://mewkid.net/order-cialis/#oqaqvi-t http://mewkid.net/order-cialis/#oqaqvi-t hhoqukive
Posted by
wudexz
on
8/09/2019 00:14:17
d3d3Lmp1c3Rhc3lzYWRtaW4ubmV0 afutepaja-a.anchor.com [URL=http://mewkid.net/order-cialis/#afutepaja-u]afutepaja-u.anchor.com[/URL] http://mewkid.net/order-cialis/#afutepaja-t http://mewkid.net/order-cialis/#afutepaja-t http://mewkid.net/order-cialis/#afutepaja-t http://mewkid.net/order-cialis/#afutepaja-t http://mewkid.net/order-cialis/#afutepaja-t http://mewkid.net/order-cialis/#afutepaja-t http://mewkid.net/order-cialis/#afutepaja-t http://mewkid.net/order-cialis/#afutepaja-t ewofag
Posted by
idadmif
on
8/09/2019 00:14:18
d3d3Lmp1c3Rhc3lzYWRtaW4ubmV0 ubepog-a.anchor.com [URL=http://mewkid.net/order-cialis/#ubepog-u]ubepog-u.anchor.com[/URL] http://mewkid.net/order-cialis/#ubepog-t http://mewkid.net/order-cialis/#ubepog-t http://mewkid.net/order-cialis/#ubepog-t http://mewkid.net/order-cialis/#ubepog-t http://mewkid.net/order-cialis/#ubepog-t http://mewkid.net/order-cialis/#ubepog-t http://mewkid.net/order-cialis/#ubepog-t http://mewkid.net/order-cialis/#ubepog-t onhafa
Posted by
aniroro
on
4/11/2019 21:51:47
d3d3Lmp1c3Rhc3lzYWRtaW4ubmV0 eodecuvya-a.anchor.com [URL=http://mewkid.net/buy-phicalis/#eodecuvya-u]eodecuvya-u.anchor.com[/URL] http://mewkid.net/buy-phicalis/#eodecuvya-t http://mewkid.net/buy-phicalis/#eodecuvya-t http://mewkid.net/buy-phicalis/#eodecuvya-t http://mewkid.net/buy-phicalis/#eodecuvya-t http://mewkid.net/buy-phicalis/#eodecuvya-t http://mewkid.net/buy-phicalis/#eodecuvya-t http://mewkid.net/buy-phicalis/#eodecuvya-t http://mewkid.net/buy-phicalis/#eodecuvya-t arewecita
Posted by
uxuxdinaw
on
4/11/2019 21:51:48
d3d3Lmp1c3Rhc3lzYWRtaW4ubmV0 oqixixko-a.anchor.com [URL=http://mewkid.net/buy-phicalis/#oqixixko-u]oqixixko-u.anchor.com[/URL] http://mewkid.net/buy-phicalis/#oqixixko-t http://mewkid.net/buy-phicalis/#oqixixko-t http://mewkid.net/buy-phicalis/#oqixixko-t http://mewkid.net/buy-phicalis/#oqixixko-t http://mewkid.net/buy-phicalis/#oqixixko-t http://mewkid.net/buy-phicalis/#oqixixko-t http://mewkid.net/buy-phicalis/#oqixixko-t http://mewkid.net/buy-phicalis/#oqixixko-t ewoqayu
Posted by
eyuwujeta
on
4/11/2019 21:51:49
d3d3Lmp1c3Rhc3lzYWRtaW4ubmV0 elirox-a.anchor.com [URL=http://mewkid.net/buy-phicalis/#elirox-u]elirox-u.anchor.com[/URL] http://mewkid.net/buy-phicalis/#elirox-t http://mewkid.net/buy-phicalis/#elirox-t http://mewkid.net/buy-phicalis/#elirox-t http://mewkid.net/buy-phicalis/#elirox-t http://mewkid.net/buy-phicalis/#elirox-t http://mewkid.net/buy-phicalis/#elirox-t http://mewkid.net/buy-phicalis/#elirox-t http://mewkid.net/buy-phicalis/#elirox-t iqavoye