Background of the issue:
We are using the WPML Pro plugin on our large web shop website, hidden link. We recently updated to the latest version and are experiencing significant issues. During our Black Friday promotion, the languages in the header and footer links were mixed up. Additionally, WPML modified the .htaccess file, causing the website to go down. We restored the previous version of the .htaccess file to resolve the issue. The problematic .htaccess file looked like this:
# BEGIN WordPress # Direktive (redci) između "BEGIN WordPress" i "END WordPress" su # dinamički generirani, i trebalo bi ih mijenjati samo koristeći WordPressove filtre. # Sve promjene direktiva između navedenih markera bit će prepisane. RewriteEngine On RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase /hr/ RewriteRule ^index.php$ - [L] RewriteRule ^hr/wp-login.php /hr/wp-login.php [QSA,L] RewriteRule ^en/wp-login.php /hr/wp-login.php [QSA,L] RewriteRule ^de/wp-login.php /hr/wp-login.php [QSA,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /hr/index.php [L] # END WordPress # php -- BEGIN cPanel-generated handler, do not edit # Set the "alt-php81" package as the default "PHP" programming language. AddHandler application/x-httpd-alt-php81___lsphp .php .php8 .phtml # php -- END cPanel-generated handler, do not edit
We replaced it with the correct version, which now works properly:
Symptoms:
Request exceeded the limit of 10 internal redirects due to probable configuration error. Languages in the header and footer links were mixed up. WPML modified the .htaccess file, causing the website to go down.
Questions:
Why did WPML modify the .htaccess file?
What needs to be done to prevent this issue from happening again?
While you wait for my colleague to take over the ticket, let me try to help you with the issue quickly.
The flush_rewrite_rules(true) function in WordPress is used to regenerate rewrite rules, which are rules that tell your website how to handle URLs. It’s a critical function but when used too often, it can cause WordPress to overwrite the .htaccess file.
This becomes problematic when it occurs during every page request or while you browse your site in another language. When this happens, WPML goes ahead and adds the language folder to home_url as usual. However, this results in an incorrect RewriteBase in .htaccess, causing your website’s front-end to break.
In this case, WPML is acting correctly and the problem is entirely in the plugin calling this function too often.
Please check next page and try workaround suggested:
Thanks for the reply. We did it according to the instructions (inserted the specified code into the functions.php file). We await further instructions.
I'll continue to help you with this issue. Let's please focus on the .htaccess file modification problem.
Has inserting the function in this guide fixed the problem?
If you want to find the problematic plugin, our further instructions are to pinpoint the plugin that causes this problem. To check this, deactivate all plugins except WPML and its add-ons and WooCommerce without any extensions. Then, please check if the problem persists. If it does not continue, start by activating the plugins individually and checking when the issue comes back, then report to me which plugin was the culprit.
**** Important! Please make a full site backup (files and DB) before you proceed with those steps****
*** If your site is live, you might want to try those procedures in a staging environment or a snapshot of your site on your local server or another server. ***
Regards,
Itamar.
The topic ‘[Closed] Request exceeded the limit of 10 internal redirects with no reason’ is closed to new replies.