This thread is resolved. Here is a description of the problem and solution.

Problem:
I am planning to change the settings and use only one domain, and use the "Different languages in directories" option.
However, if I make this change, people going to the secondary "unused domains" or following old URLs will see a 404 error.
I would like to redirect all the pages from my three domains to the specific "Different languages in directories".

Solution:
Here is an example of the setup you need, assuming you have two languages:
- example.com - English - default language
- pl.example.com - Polish - second language

With your change, you should add the following block to your nginx:

server {
        #implemented by default, change if you need different ip or port
        #listen *:80 | *:8000;
        server_name pl.example.com;
        return 301 $scheme://example.com/pl$request_uri;
}

Relevant Documentation:
http://stackoverflow.com/questions/10294481/how-to-redirect-a-url-in-nginx

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 2 replies, has 2 voices.

Last updated by Sergio 4 years, 6 months ago.

Assigned support staff: Dat Hoang.

Author Posts
December 8, 2015 at 3:16 pm #763799

Sergio

Hello, I hope you can help me. I have a site with 3 languages. One in each domain.
I am planning to change the settings and use only 1 domain, and use the "Different languages in directories" option.

However if I make this change, the people that will go to the 2 "unused domains" or that will follow old URLs, will see a 404 error.

I would like to redirect all the pages from my 3 domains to the specific "Different languages in directories".

Can you please help? If yes I can give the list of domains and how/where they should redirect.

Thank you

December 9, 2015 at 9:33 am #764415

Dat Hoang

Hi,

I assume that you have 2 languages:
* example.com - English - default language
* pl.example.com - Polish - 2nd language

With your change, you should add the following block to your nginx:

server {
        #implemented by default, change if you need different ip or port
        #listen *:80 | *:8000;
        server_name pl.example.com;
        return 301 $<em><u>hidden link</u></em>;
}

Actually this is nothing related to WPML 🙂
Reference: http://stackoverflow.com/questions/10294481/how-to-redirect-a-url-in-nginx

December 24, 2015 at 12:05 am #775972

Sergio

Thank you