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?
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.
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.