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 thread is resolved. Here is a description of the problem and solution.

Problem: Some wrong settings caused an issue with "Use directory for default language". A 500 error was showing. Solution: The client reports here that pressing the 'Reset Settings' button in WPML -> Languages probably solved the problem.

This topic contains 8 replies, has 2 voices.

Last updated by Itamar 2 years, 4 months ago.

Assigned support staff: Itamar.

Author Posts
January 28, 2017 at 12:21 pm #1192892


Hello, i have the same bug than with WPML 3.6.2, using last version of WordPress.

I tried upgrading wordpress and plugins manually cleanly from fresh files :
deactivated all plugins, removed wordpress and plugins(everything), downloaded last plugins version + last wordpress, upgrading wordpress, reactivating new plugin

i still have this bug ( i activate only the plugin WPML, and then save the Permalinks settings page)

in htaccess i have "RewriteBase /en/" :

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

is there any way to fix this bug or the only solution is to prevent wordpress from editing the htaccess ?

it should be a bug somewhere in the database i guess.. i checked options and default url is not with "/en/"

The bug happens only if in WPML settings i check "Use directory for default language", if i uncheck and save Permalinks settings, it works.

any idea how i can fix that ? because i want to have /en/ for english language

ps : i were using WooCommerce and WooCommerce Multilangual

January 28, 2017 at 2:32 pm #1192923


I want to point out the problem is that "en/" is added to .htaccess when WPML is activated with setting "Use directory for default language" activated. And i don't want the "/en"/ : it causes a 500 error

January 30, 2017 at 12:28 pm #1193621


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

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

Hello, @fabricev-2.

Thank you for contacting the WPML support forum.
I'm sorry for the late reply here.

I've tried to replicate your issue on my local server but I couldn't.
I've set up my test site to "Use directory for default language, " and I could not see any change in the .htaccess file.
On my test site, I'm using the beta version for WPML 3.6.3
WPML 3.6.3 should be officially today.
Can you, please update WPML to version 3.6.3 and see if it solves the problem.

I look forward to your reply!


January 30, 2017 at 7:08 pm #1194151


I updated and i still have the same error.
There must be something in WPML plugin (probably using some settings in the database, because it's not a fresh database) which is editing the htaccess settings... I tried with only 1 plugin activated (WPML) and using default Fifteen theme, and i still have this bug.

(by the way after updating all plugins, i have this message, even though everything is up to date)

WPML Update is Incomplete

You are running updated wpml-sticky-links, but the following component is not updated:
Your site will not work as it should in this configuration Please update all components which you are using. For WPML components you can receive updates from your account or automatically, after you register WPML.
January 30, 2017 at 10:05 pm #1194295


Wordpress uses $home_root when he write the RewriteBase line in .htaccess

in wordpress core - public function mod_rewrite_rules() :

$home_root = parse_url(home_url());
		if ( isset( $home_root['path'] ) )
			$home_root = trailingslashit($home_root['path']);
			$home_root = '/';

		$rules = "<IfModule mod_rewrite.c>\n";
		$rules .= "RewriteEngine On\n";
		$rules .= "RewriteBase $home_root\n";

When i activate WPML, if it output home_url(), i have "mydomain/en" so no surprise the htaccess is written with RewriteBase /en/ . (also seen in WPML debug infos "HomeURL")

but my problem is still not resolved, hope it can helps though..

January 30, 2017 at 10:20 pm #1194302


I found the WPML code updating the home_url() value :
in class WPML_URL_Filters :

public function home_url_filter( $url, $path, $orig_scheme, $blog_id ) {
		$server_name = isset( $_SERVER['SERVER_NAME'] ) ? $_SERVER['SERVER_NAME'] : "";
		$request_uri = isset( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : "";
		$server_name = strpos( $request_uri, '/' ) === 0
				? untrailingslashit( $server_name ) : trailingslashit( $server_name );
		$url_snippet = $server_name . $request_uri;

		$url_language = $this->url_converter->get_language_from_url( $url_snippet );

		$home_url = $this->url_converter->convert_url( $url, $url_language );

		$home_url = apply_filters('wpml_get_home_url', $home_url, $url, $path, $orig_scheme, $blog_id);

		return $home_url;

this is causing the wrong RewriteBase, i don't understand why but it's editing the WordPress home_url() to hidden link instead of hidden link

January 31, 2017 at 9:36 pm #1195439


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

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

Thanks, @fabricev-2 for all this information.

When I check your debug information, I can see this.

SiteURL hidden link
HomeURL hidden link

The URL ending is missing there.
Why is it like that?
What is set up for you in Settings -> General for WordPress Address (URL) and for Site Address (URL)?

I look forward to your reply!


January 31, 2017 at 10:07 pm #1195458


It's because i'm upgrading plugins from my local server. so that's the good url, without domain extensions.

But i fixed the problem some hours ago, only playing with settings in WPML settings 'Languages', i added and removed languages, changed order and priorities, and also clicked on "Reset settings" (i think that's what fixed it) and then put back all settings like they were when it wasn't working.

Doing this fixed the bug and now it's working !

I think the database was messed up by some previous things, and updating back and forth the settings from this admin page fixed the problem.

Thanks for your help !

February 1, 2017 at 9:49 am #1195810


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

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

Great, @fabricev-2!
I'm glad that it is solved now 🙂
Good luck with your project.