[Resolved] using 2 domains for 2 separate languages
This thread is resolved. Here is a description of the problem and solution.
Problem: You are using WPML to manage translations for your website with separate domains for different languages. The language switcher works on the .pl domain but not on the .com domain. Additionally, saving settings in WPML->Languages results in a red void/invalid message on the .com domain. Solution: First, ensure that all your domains (or subdomains) point to the same WordPress site where WPML is installed. For more information, please visit this documentation. Next, deactivate the "Validate on save" option, enter your second domain, save your changes, and then test the domain to see if it works. The validation message might be a false positive. After translating the page, check if you can access it using your secondary domain. If it doesn't work, your second domain might not be configured correctly. Additionally, check your config.php file for these lines:
Commenting out these lines can resolve the issue with the language switcher.
If this solution does not apply to your case, or if it seems outdated, we 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 issues persist, please open a new support ticket at 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.
Background of the issue:
I am using WPML to manage translations for my website hidden link. I have two domains for two separate languages: Polish on the .pl domain and English on the .com domain. The .com domain is parked on the same account.
Symptoms:
I have the translation for the English language on the .com domain. The switch works on the .pl domain but not on the .com domain. Additionally, saving settings in WPML->Languages gives me a red void/invalid message on the .com domain.
Questions:
Is there any other documentation to follow for setting up WPML with multiple domains? where is the problem
I recommend deactivating the "Validate on save" option, entering your second domain, saving your changes, and then testing the domain to see if it works. Sometimes, the validation message can be a false positive. After translating the page, check if you can access it using your secondary domain. If it doesn't work, your second domain is not configured correctly.
I have double-checked all the domain parameters and DNS settings – both domains are correctly pointing to the same WordPress installation. The main domain (.pl) works as expected, including language switching. However, the secondary domain (.com) not working properly even after disabling the “Validate on save” option as you suggested.
The .com domain loads the translated content properly, but the language switch point both langs to .com domain - this is the only problem.
Could you please take another look or guide me further on what else might be causing this issue? I would appreciate any additional insight or steps I could try. This is not my first rodeo with WPML and I know, how many I don't know 🙂
Yes, I have already tested this. Have you tried adding it to the menu and testing?
I need to request temporary access (wp-admin and FTP) to your site—preferably to a test site where the problem has been replicated if possible—in order to be of better help. When you log in to leave your next reply, you will find the needed fields below the comment area. The information you will enter is private, meaning only you and I can see and access it.
I have reviewed the WPML settings and options, and everything appears to be configured correctly in your dashboard. There is no issue if I temporarily switch to another URL format, "Different languages in directories", in WPML → Languages → Language URL format.
However, this leads me to think that the domain configuration may be the issue. I'm not familiar with your server settings or how your hosting operates. Generally, to set up a secondary domain locally, you would point the secondary domain to the local server and configure it as an alias in the server settings.
Would you mind checking if there is an alternative way to configure your secondary domain according to the article above?
I changed domain from parked domain to addon domain, but that changes nothing. Domain config you can check with any DNS tool and both domains point to the same place. Everything works fine except one switch. For some reason can't save domain, and this plugin don't say what is wrong. Can you suggest some debug way to get info, what is wrong with domain, why this save function returns error?
There is no specific debugging tool that indicates what is wrong with the domain settings. However, you can try activating the debugging feature in WordPress to see if any related errors appear.
To enable it, open your wp-config.php file and look for define('WP_DEBUG', false);. Change it to:
define('WP_DEBUG', true);
To enable the error logging to a file on the server, you need to add yet one more similar line:
define( 'WP_DEBUG_LOG', true );
The errors will be saved to a debug.log file inside the /wp-content/directory.
Let me know what you see in the debug.log after enabling debug mode.
Can I create a copy of your site to test if the domains work on a local server? I'll need to install a "Duplicator" temporarily or "All In One Migration" plugin on your site. This will allow me to create a copy of your site and your content.
I have conducted some tests locally in a fresh environment using the "A different domain per language" option, and I could not replicate the problem.
I can test your site in my local environment to see if I can replicate the issue using your site. This will help us understand if the problem lies with the domains or with the specific installation. However, I am not clear if I am allowed to make a copy of your site for this purpose.