Resolved
Resolved in: 3.7.0
Overview of the issue
If you configure WPML with a different domain per language on a nginx server you will get redirected to the home page in the default language every time.
The problem seems to come from nginx which returns an incorrect HTTP_HOST variable when REQUEST_URI is empty.
Workaround
To resolve this, you can create a separate sever block for each domain.
For example, your typical nginx configuration will look something like this:
server { server_name example.com example.es; root /var/www/html; index index.php; location / { try_files $uri $uri/ /index.php?q=$uri&$args; } }
To resolve it, create a server block for each server_name like this:
server { server_name example.com; root /var/www/html; index index.php; location / { try_files $uri $uri/ /index.php?q=$uri&$args; } } server { server_name example.es; root /var/www/html; index index.php; location / { try_files $uri $uri/ /index.php?q=$uri&$args; } }
Your exact configuration may vary. It is just a matter of duplicating the server block and setting a different server_name for each block.
Finally, you need to restart nginx and try again.