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.


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


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
Leave a Reply

(Your email will not be publicly displayed.)