Home›Support›English Support›[Resolved] Menu redirects back to main language wrongly when using a different domain
[Resolved] Menu redirects back to main language wrongly when using a different domain
This thread is resolved. Here is a description of the problem and solution.
Problem:
The issue involves the href for English on the website pointing to the .de domain instead of the expected .com domain. This problem surfaced after changing the plugin to use the new .de domain instead of a /de subdirectory. The attempted fix using JavaScript is considered less than ideal.
Solution:
1. Verify language domain setup per WPML documentation, ensuring different domains per language are correctly configured.
2. Investigate the hosting provider's feedback and assess any unusual code in the wp-config.php file.
Remove any code overriding default domain behavior from wp-config.php and ask the hosting provider to configure parked domains properly.
Link to a page where the issue can be seen: hidden link
or any other .de page
I expected to see:
the href for English to be .com
Instead, I got:
the href for English is set to .de
---
We recently changed the plugin to use the new .de domain instead of a /de subdirectory
For now I tried to fix it using Javascript and this works but is far from ideal. (This also means the issue won't be visible unless you inspect the view-source)
I would like to request temporary access (wp-admin and FTP) to your site to test the issue.
(preferably to a test site where the problem has been replicated if possible)
**Before we proceed It is necessary to take FULL BACKUP of your database and your website. Providing us with access, you agree that a backup has been taken **
I often use the Duplicator plugin for this purpose: http://wordpress.org/plugins/duplicator/
You will find the needed fields for this below the comment area when you log in to leave your next reply.
The information you enter is private which means only you and I have access to it.
NOTE: If access to the live site is not possible and the staging site does not exist please provide me with a duplicator package created with the duplicator plugin.
Your default language (WPML->Languages) is set to English.
With the URL Format "different domain per language" you have correctly set the domain to .de for German, but the English domain is also by default set to .de
If I go to WordPress->Settings->General, I can also confirm the SiteURL and HomeURL in the database are set to the .de domain.
In this case, you would want German to be the default language and English secondary with the .com set as the domain.
Otherwise, you can keep English as the default language but you will need to work with your hosting team to change the URL of your site to the .com one.
Without WPML activated for example your site's URL is .de and not .com.
So changing the default language on the .de admin to German would fix the issue?
Would that not also change the default language on the .com? Or are those two seperated from each other?
Edit: I tried to change the default language and it resulted in the same issue, but now it was the .de that did not point to the correct url.
I did undo this action though by putting back a backup.
Any idea how this could be fixed?
Maybe to be sure: the .de is a parked domain on our server.
Hello, we have contacted our server host and they came back:
the server and domain settings seem to be correctly set up, the only thing they noticed as odd was the code that set the WP_HOME and WP_SITEURL to 'hidden link'.$_SERVER['HTTP_HOST'])
this was done to override the default behavior of the parked domain, initially the .de would simply redirect to .com, and not stay to show the translations. This code fixed that; but now we are wondering if that could influence the workings of the wpml-plugin
Yes, that code in your wp-config.php would cause the issue we are seeing here and has been known to cause issues in the past with other behaviors as well.
If possible, please remove it and ask your hosting company the following:
"When using separate domains: I want to add a parked domain (alias) to my existing domain. My existing domain is “example.com”. I want to park the “example.de” domain."
They should be able to fix this without the need of that code.
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.