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

Last updated by Itamar 1 year, 2 months ago.

Assigned support staff: Itamar.

Author Posts
July 20, 2018 at 8:37 am

Jeroen Buggenhoudt

I am trying to:
The redirection from non www to www is not working properly.
I have been trying a number of different .htaccess solutions and I already put in the url with www in wordpress.

Link to a page where the issue can be seen:
brody.be (without cache, no redirect to www)
brody.be/nl (without cache, redirect to www)

I expected to see:
A redirection to www.

Instead, I got:
No redirection to www.

Duplicator:
I cannot make a duplicator zip because the runtime of my server is not long enough.

July 23, 2018 at 9:44 am #2569140

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

I'm not sure that the redirection issue is related to WPML.
Could you please tell me if there is an automatic redirection from your main domain brody.be/ to your domain with WWW hidden link when WPML is deactivated?

What I am expecting to see is a redirection from brody.be/ to brody.be/nl/.
I'm expecting to see this redirection because of that in WPML -> Languages -> Language URL format you have set the option 'Use directory for default language'. But this setting is not completed on your site because you have not specified any HTML file or a page. Please see the attached screenshot.

Did you intend to use this option?
You can read more about it in our documentation here.
https://wpml.org/documentation/getting-started-guide/language-setup/directory-default-language/
If you did not intend to use this option, then please uncheck it. But if you do intend to use this option, then please proceed and specify a page or an HTML file.
I'm not sure, but maybe it will also solve other redirection issues.

Regards,
Itamar.

July 23, 2018 at 12:25 pm #2569682

Jeroen Buggenhoudt

The redirection happens when wpml is disabled.
Could we fix this through the .htaccess file?
How would you redirect it?

July 23, 2018 at 5:57 pm #2570969

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

I'm not sure that it would be wise to add anything in the .htaccess file.
It supposes to work also when WPML is active.
What about the option to use a directory for default language?
Is it still enabled on your site without specifying an HTML file or a page?

Regards,
Itamar.

July 24, 2018 at 7:18 am #2572343

Jeroen Buggenhoudt

If I uncheck this option "Use directory for default language".
Some permalinks break. But this is a live site.
Can we add a page in the root without affecting the website?
Do I need to create a root page. If I just check the option, will this automatically go to brody.be/nl then?

July 24, 2018 at 11:02 am #2573420

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

I've just noticed something fundamental that I've overlooked that concerns your case.
Your site is on a Nginx server and not an Apache server.
Please confirm this.
Nginx servers do not use .htaccess files as Apache servers use.
Nginx servers use the nginx.conf file.
Here are some reference links for this issue.
hidden link
https://stackoverflow.com/questions/35766676/how-can-i-use-htaccess-file-in-nginx
You have mentioned that you have tried a few .htaccess solutions, but they will never work on a Nginx server. Therefore you need to configure the redirection from non-www to www in the nginx.conf file. Here is an example of what suppose to work in your case.

server {
    listen 80;
    server_name yourdomain.com;

    return 301 <em><u>hidden link</u></em>;
}

Please see a referance for this at the following links.
https://wpml.org/forums/topic/no-www-to-www-with-nginx/page/2/#post-2436045
hidden link

I hope that this information will help you solve the WWW redirection issue on your site.
Please get support for this from your hosting service support.

As for the 'Use directory for default language' issue.
You ask: "Can we add a page in the root without affecting the website?"
I'm not sure what you mean by saying 'without affecting'. Generally saying, it will change the page that is on the main domain of your site. This page will have no language associated with it.
You ask: "Do I need to create a root page."
Definitely yes.

You also ask: "If I just check the option, will this automatically go to brody.be/nl then?"
No. I'm sorry if a previous answer that I gave was misleading to think that it will redirect. This is my mistake.

I'll now explain here in details about the 'Use directory for default language' option.
If your site uses two languages, English (default language) and Italian (second language).
And you check the option 'Different languages in directories' and also the option 'Use directory for default language' then you will have your site's homepages URLs like so:
English -> hidden link
Italian -> hidden link
But then you need to also have a page for the original homepage URL of your site here -> hidden link
So this is why you need to specify a page or an HTML file.
You can not leave it unspecified.
Users usually choose this option when they want the visitors to their site to choose the language in which they will view the site from the root URL of the site.
So you can put a Language Switcher and some general words about your site here hidden link to make it friendly to your users.
Nevertheless, if you do not use the option 'Use directory for default language' then you will have your site's homepages URLs like so:
English -> hidden link
Italian -> hidden link
This is what most of the WPML users do, and it is up to you to decide according to your site's needs.

Thanks,
Itamar.

August 3, 2018 at 5:09 pm #2611117

Jeroen Buggenhoudt

We already tried this but we got an error in URL like nl/nl/nl etc If we remove this plugin "WPML Multilingual CMS" the issue has been gone but when we install it again the issue comes again.

Please give me a better solution. I would be glad if you check the problem properly and give us a better solution.

thanks

August 12, 2018 at 8:49 am #2637519

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi there.

You have marked this ticket as resolved and it caused me to miss your reply.
Do you still need help on this issue?

Regards,
Itamar.

August 13, 2018 at 6:51 pm #2640949

Jeroen Buggenhoudt

No, issue is still there.

Could you help us further?

August 14, 2018 at 12:12 pm #2643294

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

Do you allow me to temporarily deactivate WPML on your site to see if there is a redirection from hidden link to hidden link ?

Regards,
Itamar.

August 14, 2018 at 12:14 pm #2643297

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

In addition to the above please also allow me to disable temporarily the 'Use directory for default language' option.

August 14, 2018 at 12:14 pm #2643298

Jeroen Buggenhoudt

Sure, but make sure to revert settings backwards, so website and URL structure keeps working like it should.

When you encounter problems, let us know immediately please.

August 15, 2018 at 4:10 pm #2647027

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi and thank for permitting me to try this.

When I deactivate WPML, the issue persists. There is no redirection from hidden link to hidden link. Please watch the video that I've recorded while I was trying it.
hidden link
Can you see that it is not working even when WPMl is deactivated?
That means that the Nginx server settings are probably incorrect.
For this, you would need to get the help of your hosting company support because it is out of the scope of WPML forum.
I hope that you can understand this.
Please let me know if you have any other questions about this issue.

Thanks,
Itamar.

August 15, 2018 at 4:12 pm #2647029

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Note to the above. I've reverted all the settings and the site is now as it it was before my checks.