Skip Navigation

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

Problem:
The client's website operates in three languages across three different domains. However, accessing the domains without the 'www' prefix redirects all traffic to the Danish version of the site.
Solution:
We recommend contacting your hosting provider as the required changes involve external settings not directly related to WPML. You should implement the following code for each domain, but please confirm this with your hosting provider and ensure you have a full website backup before making any changes:

# BEGIN WordPress<br /># The directives (lines) between "BEGIN WordPress" and "END WordPress" are<br /># dynamically generated, and should only be modified via WordPress filters.<br /># Any changes to the directives between these markers will be overwritten.<br /><ifmodule mod_rewrite.c><br />RewriteEngine On<br />RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]<br />RewriteBase /<br />RewriteRule ^index\.php$ - [L]<br />RewriteCond %{REQUEST_FILENAME} !-f<br />RewriteCond %{REQUEST_FILENAME} !-d<br />RewriteRule . /index.php [L]<br />RewriteCond %{HTTP_HOST} !^www\.<br />RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]<br /></ifmodule><br /># END WordPress

If this solution does not resolve your issue or seems irrelevant due to being outdated or not applicable to your case, 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 further assistance is needed, 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.

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Lucas Vidal de Andrade 1 week, 3 days ago.

Assisted by: Lucas Vidal de Andrade.

Author Posts
September 23, 2024 at 12:24 pm #16209542

uffeS

Background of the issue:
The website hidden link has three languages on three different domains. Danish on hidden link (the main domain), Norwegian on hidden link, and English on hidden link. All this works fine.

Symptoms:
If you try to access the website with a URL without the www, they all land on the Danish part of the website: hidden link.

Questions:
How can I make a setup where both hidden link and hidden link land on the Norwegian site?
How can I make a setup where both hidden link and hidden link land on the English site?

September 23, 2024 at 5:50 pm #16211319

Lucas Vidal de Andrade
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hey there,

Thanks for contacting WPML forums support. I’ll be glad to help you today.

1) Could you please check the following tickets?
1- https://wpml.org/forums/topic/non-www-redirects-to-default-language/
2- https://wpml.org/forums/topic/second-language-www-domain-working-non-www-defaults-to-english-2/#post-6307283

2) Could you please share your Debug information with me?
You can read a detailed explanation about it here.
http://wpml.org/faq/provide-debug-information-faster-support
The debug info will give me a lot of information about how your site is configured and help me understand the problem.

Finally, let me know if your server is NGINX or APACHE. If you're not sure, you can ask your hosting provider.

Thanks for your cooperation

Regards,
Lucas

September 24, 2024 at 11:52 am #16214504

uffeS

Hi Lucas

Thanks for the reply - I think we are on the right track here. But I'm gonna need a little help to make sure, that put the right code in the .htaccess.

I'm not that code savvy, so I need to be sure, that the code I insert in .htaccess redirects visits without www in the url to the same address but with www in the url.

I think it is like the second link you posted:
https://wpml.org/forums/topic/second-language-www-domain-working-non-www-defaults-to-english-2/#post-6307283

Just opposite... this one is redirecting urls with www to urls without www - as far as I could understand.

[removed by support]

September 24, 2024 at 12:58 pm #16215041

Lucas Vidal de Andrade
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hey there,

I removed the previous code because it's not readable when pasted directly in the forum text field. But I'm guessing we won't be needing that right now.

As for the code, I'd recommend you to reach out to your hosting provider, as this is an external setting that is not directly related to WPML. They should be able to better assist you on this matter.

The code you implement for each domain, should look something like the one below. Please confirm it with your hosting provider and make sure to ahve a full website backup before making any changes:

# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ <em><u>hidden link</u></em>{HTTP_HOST}/$1 [R=301,L]
</IfModule>
# END WordPress
uffeS confirmed that the issue was resolved on 2024-09-30 07:23:03.
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.