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.

Comments:

Posted by Brian on
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
Such an easy and great solution. Thanks a lot!!
Posted by Janess on
It's good to get a fresh way of loionkg at it.
Posted by Jaylon on
Inltcligenee and simplicity - easy to understand how you think.
Posted by Spud on
Super inrvomatife writing; keep it up.
Posted by Lucy on
This forum needed shnkiag up and you've just done that. Great post!
Posted by Robbie on
Well I guess I don't have to spend the weekend fingirug this one out!
Posted by Tori on
Great post with lots of imnpotart stuff.
Posted by JamesClept on
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
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
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
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
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
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
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
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
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
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
Leave a Reply



(Your email will not be publicly displayed.)