Home » Documentation » Getting Started Guide » Language Setup » Cannot Activate Language Directories

Cannot Activate Language Directories

If WPML doesn’t let you choose language directories (e.g. http://example.com/es/ for Spanish), it’s because it tried accessing that URL and get an error.

Here is what you need to set up in order for language directories to work:

  1. Enable URL rewriting (we’ll get to it in a minute).

How WPML determines if it can enable languages in directories

WPML tries to access a test call that checks if languages in directories will work. This test call is:

yourdomain/LANGUAGE/?____icl_validate_domain=1

For example to check if Spanish is enabled for our own domain (wpml.org), we would call:

http://wpml.org/es/?____icl_validate_domain=1

When you make this call, you’ll get a blank looking page. Its content (which you can see by looking at the page’s source) is:

<!--http://wpml.org-->

This tells WPML that WordPress allows accessing this URL structure. If the call passes, WPML will allow using languages per directories. Otherwise, you’ll get some sort of message which (kind of) explains what the problem is.

If WPML sees an error page it disables this feature and prints out that red error message, with possible explanations for why it’s disabled.

Important: WPML accesses the validation URL by doing an fopen call to it. Normally, it’s similar to what browsers do, but not the same. Make sure that fopen is enabled on your server. You can set add the following to your PHP configuration file to make sure that it’s not blocked:

SecFilterEngine Off

Make sure that WordPress enables URL rewriting

In order to enable URL rewrite, WordPress will create a file called .htaccess in the folder where it’s installed. WordPress will create this file if you’re using anything other than default URLs. That file should contain the following:

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

If it doesn’t exist, try creating it. If it exists but is empty, copy these contents and save.

What does being able to rewrite URLs mean?

URL rewriting is a complex mechanism, used intensively by WordPress. For this to work, the web server (normally, Apache) needs to be able to rewrite URLs and WordPress must be allowed to manage the rewrite logic.

In Apache, mod-rewrite does URL rewriting. It’s a pretty standard module which is enabled by default. If you’re using Apache and cannot activate language directories, check that mod-rewrite is active for your site. If you’re not sure how, shoot an email to your hosting providing. You can use this:

Hey there!

A WordPress plugin that I want to use requires the mod-rewrite module enabled. Can you please check for me and tell me if mod-rewrite is enabled for my website? http://example.com

Assuming it’s enabled, WordPress now needs to be able to control the URL write rules. For this to happen, WordPress must be able to write to the folder in which it’s installed.

Again, if you’re using Apache, find out under which user Apache runs and allow that user read and write access to the folder where WordPress is installed. You can do that using your FTP program, via shell or via email:

Hello again,

I need another favor. I’ve installed WordPress in this directory:

YOUR_WP_INSTALL_DIRECTORY

Can you change the file permissions for the entire directory (recursively), so that the web server can both read and write there? I need WordPress to be able to write to some of the files.

Now, check again.

If this still doesn’t work, feel free to drop by the forum and open a new issue.

<!--http://wpml.org-->