Navigation überspringen

Dies ist das technische Support-Forum für WPML – das mehrsprachige WordPress-Plugin.

Mitlesen können alle, doch nur WPML-Kunden können hier Fragen veröffentlichen. Das WPML-Team antwortet im Forum an 6 Tagen pro Woche, 22 Stunden am Tag.

Sun Mon Tue Wed Thu Fri Sat
12:00 – 20:00 12:00 – 20:00 12:00 – 20:00 12:00 – 20:00 12:00 – 20:00 - -
- - - - - - -

Zeitzone des Supporters: Asia/Karachi (GMT+05:00)

Dieses Thema enthält 1 Antwort, hat 0 Stimmen.

Zuletzt aktualisiert von Noman Vor 6 Monaten, 1 Woche.

Assistiert von: Noman.

Autor Beiträge
Dezember 18, 2024 um 9:35 am #16524890

svenD-9

Background of the issue:
Hello,

On our website, the .htaccess is changed from time to time by a plugin. As a result, the subpages of the site are no longer accessible.

The htaccess changes from standard WordPress to:

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

Since we see language-based rewrite rules here, we assume that this comes from WPML.
Can you give us a hint for which action WPML could do something like this?

Symptoms:
The subpages of the site are no longer accessible due to changes in the .htaccess file.

Questions:
Can you give us a hint for which action WPML could do something like this?

Dezember 18, 2024 um 9:45 am #16524968

Noman
WPML-Unterstützer seit 06/2016

Sprachen: Englisch (English )

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

Hi,

Thank you for contacting WPML Support. This type of issue usually arises due to some third party plugins when they call flush_rewrite_rules(true) function too often and it can only be fixed directly by the plugin author.

As a quick workaround, could you please try to follow the below steps and see if this resolves your issue:

1. Please take a backup of your site first for safety reasons.

2. Add the below code in the functions.php file of your 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;
}

3. Re-save the permalinks from the Settings >> Permalinks page by pressing the Save Changes button.

4. Delete all sorts of caches on your site/server cache if any / plugin cache / CDN cache, clear the browser cache, and then see if it resolves the issue afterward.

Here you can see more details about it:
https://wpml.org/faq/why-is-htaccess-getting-overwritten-with-the-language-folder-on-my-wpml-website/

Please let me know the results,
Thank you for your cooperation

Das Thema „[Geschlossen] htaccess changes via plugin“ ist für neue Antworten geschlossen.