Content Negotiation For Nginx for multilingual website.
April 24, 2023 04:52AM
Hey community, I have been going through nginx configuration issues for setting up language based redirection of multi language site.


map "$http_accept_language" $homeUrl {

default http://XYZ.cloudfront.net;
~es http://XYZ.wpengine.com/es/;
~fr http://XYZ.wpengine.com/fr/;
~zh http://XYZ.wpengine.com/zh-hans/;
~de http://XYZ.wpengine.com/de/;
}

The actual issue we are facing is if a user has browser language of Spanish /es if he try's to switch to English it is not being redirected but for any other language like /fr or /de it's working as expected.

Any suggestions on this domain would appreciated and if you need any more info please comment about it.



Edited 1 time(s). Last edit at 04/24/2023 04:55AM by venkateshch.
Re: Content Negotiation For Nginx for multilingual website.
April 24, 2023 06:14AM
If this 'default http://XYZ.cloudfront.net;' is also for EN, add such line explicitly,
~en http://XYZ.wpengine.com/;

---
nginx for Windows http://nginx-win.ecsds.eu/
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 158
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready