Skip to content Skip to sidebar

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

Problem:
The client was experiencing issues with domain configuration for a multilingual WordPress site using WPML. They were working on a staging site and had issues with URLs not updating after changing the domain for the French version of the site, resulting in broken layouts and the language switcher not correctly redirecting to the corresponding language page.

Solution:
1. We advised the client to point all second-level domains to the same hosting IP as the main domain of the live site, as the translation content is saved in the database and will remain intact when pushing from staging to live.
2. We provided a link to our documentation for setting up different domains per language: https://wpml.org/documentation/getting-started-guide/language-setup/language-url-options/how-to-use-wpml-with-different-domains-per-language/
3. To fix the URL issue, we commented out the following code in the

wp-config.php

file:

//define('WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST']);
//define('WP_HOME', 'https://' . $_SERVER['HTTP_HOST']);

4. We instructed the client to re-save the settings in Settings > General to update the WordPress and Site Address URL.
5. We noted that the Chinese Simplified and Traditional domains were not working because they were not pointed to the same site as the English and FR domains.

If the solution provided here is not relevant to your case, either because it's outdated or not applicable, we recommend opening a new support ticket. We also highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If further assistance is needed, please contact us in the WPML support forum.

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 15 replies, has 2 voices.

Last updated by Long Nguyen 1 year, 6 months ago.

Assisted by: Long Nguyen.

Author Posts
February 2, 2024 at 8:50 pm #15261193

cathyM-3

Hello

We do all our translations on staging and push live - so the live site is essentially a copy of the staging site. We have purchased 2 domains

FR Site
equiton.fr
Chinese
equiton.ch (we will use the 2 subdomains coming from .ch)
traditional – sc.equiton.ch
simplified – tc.equiton.ch

Where should these point to if we do all the translations on staging?

Regards

February 5, 2024 at 8:26 am #15264516

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi Cathy,

Thank you for contacting WPML support, I'd be happy to help you with this issue.

All the second domains should be pointed to the same site (hosting IP) as the main domain of the live site.
The translation content is saved in the database so no matter if you translate the content on the staging site and push it to the live site.

Refer documentation https://wpml.org/documentation/getting-started-guide/language-setup/language-url-options/how-to-use-wpml-with-different-domains-per-language/

Look forward to your reply.
Thanks

February 8, 2024 at 2:21 pm #15281730

cathyM-3

Hello - so the domains are connected to the DNS and host
equiton.fr
equiton.ch
which will be 2 subdomains for simplified and chinese -
sc.equiton.ch
tc.equiton.ch

The domains points to the hosting ip but the url redirects to .com if you try accessing the domains. Please let me know if this setup is good to go.

February 9, 2024 at 7:15 am #15284154

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

No, please remove the redirection. Before using WPML, you need to setup second domains .fr,. .ch to point to the hosting IP and you can access your site from all domains .com, .fr, .ch without the redirection.

Then activate WPML and enable option "Different domains per language". Please follow the test setup in the documentation https://wpml.org/documentation/getting-started-guide/language-setup/language-url-options/how-to-use-wpml-with-different-domains-per-language/#testing-if-the-domains-are-set-properly


It’s easy to check if the domains are set up properly. Before you set the option in WPML, simply visit your new domains or subdomains. They should all show the same site without a redirection.

For example, if you have the domains “example.com” and “example.de” (and WPML is deactivated) you should see the same content when you visit any of these domains.

Look forward to your reply.
Thanks

February 13, 2024 at 4:12 pm #15298816

cathyM-3

Hello

All these domains are now setup without redirection but they are not validating

equiton.fr
equiton.ch
which will be 2 subdomains for simplified and chinese -
sc.equiton.ch
tc.equiton.ch

I am doing this on the live site

February 14, 2024 at 1:25 am #15300002

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

Sometimes the validation domain doesn't work correctly, please untick the option "Validate on save" > Save and check the result in the frontend.

Look forward to your reply.
Thanks

February 26, 2024 at 3:20 pm #15345111

cathyM-3

Hello - it works when i uncheck the validate on save, but all the links now break. Is there a way to auto update the links without impacting our pages? Thanks

February 27, 2024 at 1:20 am #15346757

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

Can you please share some screenshots of the break links? Also, I would like to request temporary access (wp-admin and FTP) to your site to take a better look at the issue. Your next reply is set to private to share the info.

❌ IMPORTANT: Please backup your database and website before proceeding ❌
You can use this plugin to create the backup: https://wordpress.org/plugins/duplicator/
✙ I would need your permission to de-activate and re-activate Plugins and the Theme to change configurations on the site if needed. This is also a reason the backup is critical.

Looking forward to your reply.
Thanks

February 28, 2024 at 1:39 am #15351704

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

Can you please setup different domains per language on the staging site so I can see the issue? And let me know what is the internal link or section that you are checking.
Or share the access to your live site so I can check it directly.

Looking forward to your reply.
Thanks

February 29, 2024 at 4:17 am #15356276

cathyM-3

Hello - i cant share access to the live site, because once you change the domains to urls our language swticher breaks. I have added the domains on the language section on the staging site. The problem is this - lets assume currently we are using different directories for our languages - take for example French - so here is a link hidden link

As you can see - its using the directory. Now once we change the domain to equiton.fr - this link breaks because its using the directory url - how can we auto update all the language links once the domain has changed on the respective pages - this is what is happening.

Please add these domains on staging

hidden link - Simplified Chinese
hidden link - Traditional Site
hidden link - FR Site

February 29, 2024 at 7:39 am #15356447

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

If I understand correctly, for example, you add a link to the page
hidden link
from the homepage. Now you change the URL format to a different domain per language, the URL is invalid.

I suggest you try two points:
1. Use a search and replace plugin to replace the old URL with the new URL. For example:
hidden link
to
hidden link

2. Use the sticky link plugin of WPML https://wpml.org/documentation/getting-started-guide/sticky-links/

Please try that on your staging site and let me know if there is still an invalid URL and where I can see that.

Looking forward to your reply.
Thanks

March 12, 2024 at 3:46 pm #15400475

cathyM-3

Hi Long

I am still having issues with this process.

Here are the steps i took - i am doing all of this on the staging site so i am going to post staging URL's.

This is our staging site
hidden link

Before updating the domain on the language section of WPML the FR URLs looked like this
hidden link

I have set a staging domain for the French Site
hidden link

I have run a search and replace to search for
hidden link and replace with hidden link

I have saved the permalinks but not all of them get updated. Some pages still have the old url. The result is that the layout is also broken - see example page
hidden link

Also on the language switcher on the top right - if i go back to EN it does not take me back to the FR page. If you want to see the backend, please don't make edits on the existing access. I have a new staging site, specific to testing this. I can provide access if required.

Thanks

March 13, 2024 at 2:35 am #15401857

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

I don't see the different domains per language enabled on the new staging site, because when I switch to French language, the URL shows the directory /fr/
hidden link

I can switch back and forth to English, French language on this page without any issues. Please enable the option different domains per language on this site, share a screen record of the issue on your end and let me know "Some pages still have the old url".

If you are testing on another site, please share the credentials of that site in your next reply.

Thanks.

Notre différence - Equiton 2024-03-13 09-31-33.jpg
March 19, 2024 at 4:58 am #15424036

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

I see that issue on your site and I fix this by commenting out the code in the file wp-config.php

define('WP_SITEURL', '<em><u>hidden link</u></em>' . $_SERVER['HTTP_HOST']);
define('WP_HOME', '<em><u>hidden link</u></em>' . $_SERVER['HTTP_HOST']);

and go to Settings > General > Re-save settings to update the WordPress and Site Address URL.

I also notice that only the FR domain is working, the Chinese Simplified and Traditional domains are not working because they are not pointed to the same site as the English and FR domains.

Looking forward to your reply.
Thanks

Screenshot 2024-03-19 at 11.05.13 2024-03-19 11-05-37.jpg
March 20, 2024 at 3:36 pm #15432738
cathyM-3

Hi Long -

Can you please explain a little bit more about what you did with the code in the wp-config.php - once we move this to the production site, will the same have to be done.

The language switcher is now working between EN and FR. I have also pointed the Chinese Sites to this development environment.

I am running into the following issues still - some URL's on the FR site are not updating with the .fr domain. Also some pages have layout issues after running updating the layout. Please see URL's

Layout Issue - hidden link
URL Not Updating - hidden link

This layout issue first happend when i did a search and replace, but i restored a backup to the search and replace and still see the issue.

So it seems across all 3 languages the URL's are not updating but also there are layout issues.

Thanks for looking into this