Error message in WPML

After activating Cloudflare CDN, I get an error message in WPML:

It looks like languages per directories will not function.

This can be a result of either:

  • WordPress is installed in a directory (not root) and you’re using default links.
  • URL rewriting is not enabled in your web server.
  • The web server cannot write to the .htaccess file

[How to fix]

When WPML accesses https://divimundo.com/es?____icl_validate_directory=1 it gets:

The expected value is:

Should I make any special settings in Cloudflare for my multilingual site? I use divimundo.com/en/ and divimundo.com/es/ and the homepage is a “neutral” page for language selection.

May I ask few questions:

  1. WordPress version are you running?
  2. WPML version is?
  3. Do you have an SSL certificate and is it valid for your main domain divimundo.com?
  4. What kind of SSL options have you got enabled at Cloudflare SSL/TLS tab for your domain?
  5. Regarding .htaccess file and rewrites, kindly re-check if it is writeable file (CHMOD 644)
  6. What kind of WordPress permalink URL structure have you got selected in WordPress settings?

Have you tried following the steps from below article?:

I have multiple WordPress websites running WPML behind Cloudflare.
Nothing special needed, in case if you mean about Page Rules, etc.

All the needed is done on the host origin/web server.

Thanks for taking your time @fritex !

Both my webhost and the WPML support has looked at my site and they can’t find what’s causing this. This is the respons from the WPML second line:

I checked the website and could not find any clue that why this is happening. It seems that Cloudflare does something that causes the issue but I am not sure what it is.

You can learn more about the possible causes here:

https://wpml.org/documentation/getting-started-guide/language-setup/cannot-activate-language-directories/

Try to play with the options of CloudFlare and disable some features and test the website (It usually takes time for changes to take place) and see if it fixes the issue.

I guess “playing around” with the settings is the way to go. :slight_smile: This is the first time I’m trying Cloudflare, so I’m a bit out of my element here.

To answer your questions:

  1. WordPress version are you running?
    5.7.2 (latest)

  2. WPML version is?
    4.4.10 (latest, I think)

  3. Do you have an SSL certificate and is it valid for your main domain divimundo.com ?
    Yes. It’s also confirmed at Test Results: divimundo.com - Why No Padlock?

  4. What kind of SSL options have you got enabled at Cloudflare SSL/TLS tab for your domain?
    “Full”. I have Let’s Encrypt at my webhost, but I guess that’s not relevant anymore?

  5. Regarding .htaccess file and rewrites, kindly re-check if it is writeable file (CHMOD 644)
    Yes, it’s 664. Read and Right for “Owner” and Read for “Group” and “Public” (translated back from Swedish, so the terms might no be 100% accurate).

  6. What kind of WordPress permalink URL structure have you got selected in WordPress settings?
    Custom structure: /blog/%postname%/

Maybe I should mention that I use WP Rocket and connected Cloudflare via that plugin. However, disabling WP Rocket (or Wordfence) does not remove the error message.

Meaning, the WPML should figure it out to make /blog/en/ or /blog/de/ or some other language, right?
I assume WPML thinks your /blog/ is a sub-directory of WordPress installation, which could be a reason why you cannot have /en/, /de/, etc. as “language directory”.

Either, this is on your main domain divimundo.com, while I beleive you have a valid reason why are you using it under the /blog/.

From other point of view, I do not understand why does WPML not recommend in that case, going by divimundo.com/blog/en/ or divimundo.com/blog/de/ regarding URL permalink scheme?

The best case scenario from my perspective would be to write a ticket on WPML forums and ask why you cannot have the option directory for default language if you have a permalink structure like /blog/.

Regarding WP Rocket, kindly see below articles how to configure it propperly, just in case:

I think the rewrite rule should go within /blog/index.php to make sure the /blog/en/, /blog/de/ would work, if the WordPress is installed under /blog/, or if it is installed under your root domain, but /blog/ is just a part of it to for example show the news and blog posts, so, I am not 100% sure again why WPML cannot work, but hm …

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.