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 thread is resolved. Here is a description of the problem and solution.

Problem: The client is trying to set up different domains per language, but each time the site loads the English URL, the Italian content is displayed.

Solution: The secondary language was redirecting always to www version. Adding a redirect for all www versions to non www in .htaccess (in primary domain) resolved the issue.

RewriteEngine On RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

just before the # BEGIN WordPress line

Tagged: 

This topic contains 7 replies, has 3 voices.

Last updated by veronikaS-2 3 years, 6 months ago.

Assigned support staff: Lauren.

Author Posts
April 15, 2016 at 9:05 am #861937

FilippoZ1

I am trying to: Setup Different Domain per Language

URL of (my) website where problem appears: hidden link

I expected to see: the homepage in English (secondary language)

Instead, I got: Homepage in italian (primary language)

Steps to duplicate the issue: Setup hidden link as domain alias for hidden link; point hidden link DNS to the same server IP where i have the Domain Alias and the primary domain; Setup WPML to use different domain per language.

All other URL on website are switching correctly, only the homepage in second language does not show the second language. Also, I would like users visiting hidden link to see directly the second language, as they were visiting hidden link

April 15, 2016 at 1:09 pm #862185

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Hi FilippoZ1, thank you for contacting WPML support. I'll be happy to help you with this.

I'd like to have you try a few things so we can try to isolate the issue. This is just to help me identify if it might be a conflict with another plugin or theme that is causing the problem.

** IMPORTANT ** Please backup a working copy of site files and database before continuing.

A. Update all WPML plugins & WordPress core.

B. Minimal Set Up ( 1. All plugins except WPML disabled 2. and then Temporarily changing the theme to a default WordPress such as TwentyFifteen 3. then finally enable all plugins and disable all WPML related ).

C. If the issue is gone after Minimal Set Up steps above, activate each plugin one by one to find out which plugin is causing the issue.

Does the issue still persist when you do each step above?

Also, do you have browser redirect activated under your WPML > Languages settings?

Thanks, I look forward to your reply.
Lauren

April 15, 2016 at 1:25 pm #862202

FilippoZ1

Hello Lauren,
thanks for your answer.

Even if I'm using a setup I trust 100%, I've already tried deactivating all plugins (except WPML) and using Twenty Fifteen theme. unfortunately the issue remains, also with just WPML installed and active.

The automatic redirect based on browser language is not active.

Let me specify one thing: URL of the 2nd language homepage is correct. Is its content that comes from the wrong language.

April 15, 2016 at 2:57 pm #862288

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Hi FilippoZ1, thanks for testing those settings for me. To best troubleshoot the problem, I would like to request temporary Administrative access to your WordPress site. Please include the Login URL, Username and Password along with your FTP connection information. Feel free to create a temporary admin user solely for this purpose.

If I need to test your site locally, I would like to temporarily install the Duplicator plugin so that I can make a snapshot of your site. I will remove the snapshot and the plugin once I am finished testing.

Your next reply will be private, only you and I will have access to it, I look forward to your reply!

IMPORTANT: Please make a backup of site files and database before providing us access.

If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. You may need to refresh your screen once you are logged in to see these fields. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this: hidden link

Thanks,
Lauren

April 15, 2016 at 4:36 pm #862366

FilippoZ1

It looks like I've found a solution.

The problem seems to be related only to www. version of website.
Wordpress URL is setup without www, but on second language the website was redirecting always to www version.

So I added a redirect for all www versions to non www, with these lines in my .htaccess (in primary domain)

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ hidden link [R=301,L]

just before the
# BEGIN WordPress
line

looks like it's working. But if I would like to better understand why 🙂

April 15, 2016 at 6:14 pm #862417

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Hi FilippoZ1, I'm glad the site is loading correctly now 🙂

The redirect problem could be due to the settings that were used in setting up the secondary language domain. A parked domain works as a mask to forward to the primary domain. If the domain was set as an alias and was trying to forward to hidden link but the correct domain is reportagedimatrimoni.it, then the browser was probably resolving to hidden link which loaded the Italian content but the URL alias made it look like it was loading hidden link. So, by forcing the site to load the correct version with the redirect you created, the site now resolves to the correct version, reportagedimatrimoni.it and reportagedimatrimoni.co.uk.

Here is some additional information about server settings for languages in different domains:
https://wpml.org/faq/server-setting-for-languages-in-different-domains/

In addition, this is a good read to undestand the difference between "add-on" and "parked" domains: hidden link.

I hope this helps! Feel free to let me know if you have any additional questions.
Lauren

April 15, 2016 at 6:35 pm #862423

FilippoZ1

Thanks for your clear explanation Lauren, you've been very helpful.
Far beyond support 🙂

May 28, 2018 at 4:28 pm #2240724

veronikaS-2

I have notice the same issue, are you able to help me configure my .htaccess?

current version is:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

I have tried to add

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ hidden link [R=301,L]

before # BEGIN WordPress but it seems it does not work.

My original domain is hidden link and second language is hidden link (works correct) but hidden link returns original language.