如何改变htaccess请求超过10个内部重定向的限制,由于可能的配置错误



在安装WPML并进行一些翻译后,我在wordpress站点上出现了一些错误,这个错误使我的站点出现500个错误

error: AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer https://mexter.reasavings.top/uk/nakopichuvalni-vodonagrivachi/

我找到了一些答案,但不是现在我该怎么做/改变这个

我的。htaccess有下一行也许我需要改变这个:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# BEGIN WordPress
# Директивы (строки) между `BEGIN WordPress` и `END WordPress`
# созданы автоматически и подлежат изменению только через фильтры WordPress.
# Сделанные вручную изменения между этими маркерами будут перезаписаны.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteRule ^ru/wp-login.php /wp-login.php [QSA,L]
RewriteRule ^uk/wp-login.php /wp-login.php [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

使用WPML的wordpress站点修复了functions.php from theme

需要添加以下行:

add_filter('mod_rewrite_rules', 'fix_rewritebase');
function fix_rewritebase($rules){
$home_root = parse_url(home_url());
if ( isset( $home_root['path'] ) ) {
$home_root = trailingslashit($home_root['path']);
} else {
$home_root = '/';
}

$wpml_root = parse_url(get_option('home'));
if ( isset( $wpml_root['path'] ) ) {
$wpml_root = trailingslashit($wpml_root['path']);
} else {
$wpml_root = '/';
}

$rules = str_replace("RewriteBase $home_root", "RewriteBase $wpml_root", $rules);
$rules = str_replace("RewriteRule . $home_root", "RewriteRule . $wpml_root", $rules);

return $rules;
}

最新更新