Skip Navigation

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 -
- - - - - - -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Waqas Bin Hasan 8 months ago.

Assisted by: Waqas Bin Hasan.

Author Posts
August 27, 2024 at 9:22 am #16108556

ricardo-jorgeT-2

Background of the issue:
We identified the WPML plugin to be the cause of a HTTP 500 server error due to a redirect loop that happens after WPML overwrites the .htaccess file in WordPress. This is the altered Rewrite declarations most likely done by WPML on the .htaccess file that was identified during the 500 server error:

# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /es/
RewriteRule ^index.php$ - [L]
RewriteRule ^en/wp-login.php /es/wp-login.php [QSA,L]
RewriteRule ^es/wp-login.php /es/wp-login.php [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /es/index.php [L]

# END WordPress

This is the normal WordPress Rewrite declarations which are saved on .htaccess file when the site is running ok:

# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteRule ^en/wp-login.php /wp-login.php [QSA,L]
RewriteRule ^es/wp-login.php /wp-login.php [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

There is a WPML faq (https://wpml.org/faq/why-is-htaccess-getting-overwritten-with-the-language-folder-on-my-wpml-website/) where this issue is discussed but we are not sure if the workaround mentioned is the correct fix for our problem. Everything on the website is updated and this error occurred also before updating to the last versions. As a consequence of these server errors that keep happening, we have to disable the plugin as recommended by the hosting support. But we would like to have WPML support to fix this error if possible before changing to another translator plugin. Link to a page where the issue can be seen: hidden link

Symptoms:
A HTTP 500 server error message due to a redirect loop caused by WPML overwriting the .htaccess file. The error affects all site pages except the homepage.

Questions:
What is causing WPML to overwrite the .htaccess file and create a redirect loop?
Is the workaround mentioned in the WPML FAQ the correct fix for this issue?
How can we prevent WPML from causing this redirect loop and HTTP 500 server error?

August 27, 2024 at 12:04 pm #16109589

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting the support.

First of all, yes the workaround in FAQ is correct, you can try that, if you don't want to go into the detailed investigation to find which plugin is actually causing it.

However, if you'd like, please try the following:

1) Take a full backup of your site and database before proceeding.
2) Deactivate all plugins except WPML.
3) Switch to a standard theme like 2024.
4) Resave permalinks and check for the issue if it still happens.
5) Then start activating plugins one by one while keep checking for the issue. This way you 'll be able to pinpoint a conflict when & where it starts creating the problem.
6) If after activating all plugins you see that it still works fine, then switch to your theme and see if that's causing it.

Regards.

The topic ‘[Closed] .htaccess getting overwritten by WPML causing a redirect loop which crashes the site with HTTP 500 s…’ is closed to new replies.