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

Last updated by Mihai Apetrei 4 months, 2 weeks ago.

Assigned support staff: Mihai Apetrei.

Author Posts
May 27, 2019 at 8:04 am #3894411

bennyV-2

We have 3 active languages in one wp installation, maak-law.com is English, maak-anwaltskanzlei.de is German and maakadvocaten.nl is Dutch.

Everything with www. works fine. When you go to hidden link you get the English website and when you go to hidden link you see the German website.

Except… when we use a non-www address. If you go non-www by example hidden link you will get redirected to de Dutch website maakadvocaten.nl. We would like to see also non-www redirects go to the right domain.

We made a Httpd.conf Customization for maakadvocaten.nl as following:

DocumentRoot /public_html
ServerName hidden link
ServerAlias hidden link
ServerAlias maak-law.com
ServerAlias hidden link
ServerAlias maak-anwaltskanzlei.de

We also tried:

DocumentRoot /public_html
ServerName hidden link
ServerAlias hidden link
ServerAlias hidden link
ServerName maakadvocaten.nl
ServerAlias maak-law.com
ServerAlias maak-anwaltskanzlei.de

Could you tell us what we are doing wrong? And help us out how to fix?

Many thanks in advance!

May 27, 2019 at 11:13 am #3896415

Mihai Apetrei
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hi and thank you for contacting WPML Support!

I will be happy to help you with this.

Can you please take a look over the ticket below and let me know if that solves the issue for you?
https://wpml.org/forums/topic/redirect-non-www-for-an-extra-domain-goes-wrong/

Please let me know.

Kind regards,
Mihai Apetrei

May 27, 2019 at 12:02 pm #3896973

bennyV-2

I checked this post but still not sure what I should add to my .htaccess file. Can you help me out?

This is what we use now:

# 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>

Should this be replaced by

END WordPress
# START non-www en non-https naar hidden link op alle talen
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ hidden link{HTTP_HOST}%{REQUEST_URI} [R=301]

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ hidden link{HTTP_HOST}%{REQUEST_URI} [R=301]
# EINDE non-www en non-https naar hidden link op alle talen

And should we replace hidden link for main domain?

May 28, 2019 at 7:28 am #3903471

Mihai Apetrei
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hi.

You should be fine by using this first default WordPress .htaccess code here:
https://wordpress.org/support/article/htaccess/

In case you have custom code inside the .htaccess file, that should come only after the "END WordPress" part.

Also, please check if you don't somehow use any other custom code somewhere else or through a plugin that might conflict with that.

I hope that this explains it a little bit better and that it helps 🙂

Please let me know how that goes.

Kind regards,
Mihai

May 28, 2019 at 3:41 pm #3908515

bennyV-2

Hi Mihai,

This is the content of my .htaccess but this doesn't work out for me:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
</IfModule>
# END WordPress

May 29, 2019 at 11:21 am #3914787

Mihai Apetrei
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hi.

Please try to use just this:

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

Let me know how that goes.

Kind regards,
Mihai

May 29, 2019 at 12:25 pm #3915337

bennyV-2

Hi Mihai,

I just tried this code but still doesn't work out. hidden link translates well but non-www in this case hidden link redirects to hidden link without the right language setting.

May 30, 2019 at 3:45 pm #3924441

Mihai Apetrei
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hi and thank you for the confirmation.

Can you also take a look over the tickets below? My guess is that there is a configuration issue somewhere in the middle as these users from the tickets below were experiencing, too:

- https://wpml.org/forums/topic/second-language-www-domain-working-non-www-defaults-to-english/
- https://wpml.org/forums/topic/when-url-is-without-www-site-redirect-to-default-langauge/ (3-pages ticket)
- https://wpml.org/forums/topic/non-www-leads-to-default-language/
- https://wpml.org/forums/topic/browser-doesnt-redirect-without-www/
- https://wpml.org/forums/topic/language-url-format-www-redirection/
- https://wpml.org/forums/topic/wont-redirect-to-www/

Please let me know how that goes.

I will be waiting for your feedback.

Kind regards,
Mihai