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: The contents of .htaccess are wrongly changed after saving permalinks.

Problem: There was a bugfix release of WPML that fixed this.

Solution: Updating to the latest version of WPML would solve the issue.

This topic contains 10 replies, has 3 voices.

Last updated by fabriceV-2 3 years, 2 months ago.

Assigned support staff: George Botsev.

Author Posts
October 21, 2015 at 9:02 pm #730218

cpacC

WPML is rewriting our htaccess file randomly for no reason. Sometimes everyday, sometimes once every few weeks.

This is our default working rewrite
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

This rewrite below is what WPML modifies and we get server 500 error for all visitors until we change it to what is posted above.

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

Please tell us how to stop WPML from writing to the htaccess file forever so we stop having this issue.

October 22, 2015 at 6:24 am #730309

George Botsev
Supporter

Languages: English (English )

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

Hello and thank you for contacting us.
This issue is a known issue related to saving permalinks and using the option "Use directory for the default language" in WPML > Languages
Currently there is no fix for this, but there is a workaround.
:Workaround
After you save the permalinks (the correct ones) you can set the .htaccess file to read only.

October 23, 2015 at 1:57 pm #731576

cpacC

What I would suggest for next version is that once WPML is installed, you offer users the ability to disable the HTACCESS rewriting completely. Since we have WPML installed we no longer need this rewrite ability so it is completely useless to have it and as we see it breaks our website randomly.

October 23, 2015 at 2:14 pm #731590

George Botsev
Supporter

Languages: English (English )

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

Thank you for your suggestions, but we cannot do that.
We strive to be as closer as possible to the core WordPress, and this is something that violates this policy.
Speaking about the issue - our developers are already on the case and it should be fixed in the next version of WPML.

October 27, 2015 at 1:54 pm #733655

cpacC

We run wordpress on windows and making the htaccess read only as in Linux is not possible.

October 27, 2015 at 2:05 pm #733663

George Botsev
Supporter

Languages: English (English )

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

I am sorry, I don't know what to suggest you here.
You might want to temporary protect the file somehow, or just don't refresh the permalinks until the issue is resolved.
This issue will be resolved in the upcoming version of WPML.

October 27, 2015 at 2:07 pm #733666

cpacC

that is great news. Do you have a timeline of when this fix will be released?

October 27, 2015 at 3:56 pm #733812

George Botsev
Supporter

Languages: English (English )

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

I am sorry, but I don't have such information.

February 2, 2016 at 1:21 pm #802493

George Botsev
Supporter

Languages: English (English )

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

The issue mentioned in this ticket is probably been resolved for some time.
I am just writing here to let you know that if you have waited for the release version, that that version should be already released and you have to give it a try.
Because of this ticket being open for so long, I am going to set it as Resolved.

Feel free to open a new forum ticket if you find out that the issue is still present and if you have any other difficulties.

Please remember as a guideline, if you are going to update, do remember to backup your database first before you proceed! You can use a plugin for this if you like (example: http://wordpress.org/plugins/duplicator/)

January 28, 2017 at 9:38 am #1192854

fabriceV-2

Hello, i have the same bug 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 12:22 pm #1192893

fabriceV-2

Update : i created my own topic there : https://wpml.org/forums/topic/wpml-add-rewritebase-en-in-htaccess/