Sauter la navigation

Ce sujet est résolu. Voici une description du problème et de la solution.

Problem:
If you're experiencing a 500 error when opening content in the English language and have noticed errors related to the WPML plugin in your logs, particularly after translating content with WPML and using the "Different languages in directories" URL format.
Solution:
We recommend taking the following steps to resolve the issue:
1. Ensure you are using the latest version of your theme and other plugins to your site including WPML.
2. Add the following code to your theme's functions.php file to fix potential rewrite rule issues:

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 your permalinks from Settings >> Permalinks by clicking the Save Changes button.
4. Clear all types of caches, including site/server cache, plugin cache, CDN cache, and browser cache.
For more details on .htaccess issues with WPML, please refer to this documentation: https://wpml.org/faq/why-is-htaccess-getting-overwritten-with-the-language-folder-on-my-wpml-website/

If the solution provided here is not relevant to your case, either because it's outdated or not applicable, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the issue persists, please do not hesitate to open a new support ticket with us.

Il s'agit du forum d'assistance technique de WPML, le plug-in multilingue pour WordPress.

Il est accessible à tous, toutefois seuls les clients de WPML peuvent y publier leurs messages. L'équipe du WPML répond sur le forum 6 jours par semaine, 22 heures par jour.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum French. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Ce sujet contient 4 réponses, a 2 voix.

Dernière mise à jour par Noman Il y a 2 mois et 1 semaine.

Assisté par: Noman.

Auteur Articles
Avril 9, 2024 à 4:49 am #15496610

arnaudD-20

Hii team i need help in urgent basis i translated most of the content with wpml but now one issue coming on en languages everytime i open en content it gives 500 error when i switched url format it temporary fixed but i want my url format "Different languages ​​in directories" this like my other projects can you please help me what is cause and what is solution i also see error from plugin logs maybe this having issue this is error "age.com/httpdocs/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Shared/st/class-wpml-pb-integration.php o" there are many this type errors in logs can you please help me fast as i need to translate 5 more languages thanks

Screenshot from 2024-04-09 10-18-35.png
Avril 9, 2024 à 6:40 am #15496795

Noman
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting WPML Support. Based on the details you provided, it appears that the issue may be related to specific plugins or themes on your site. To address this, could you please follow the below steps and see if this resolves your issue:

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

2. The current WP Memory Limit on your site is 40MB. The WP memory limit needs to be increased, it's different from PHP memory. PHP memory is fine but WordPress uses 40MB as default in your site. The minimum requirements for WPML are 128MB: https://wpml.org/home/minimum-requirements/

Please add this to the top of wp-config.php to increase WP memory:

/* WP Memory Limit */
define('WP_MEMORY_LIMIT', '256M');

3. We have recently released WPML 4.6.10, could you please update it to the latest version.

You can update it from Plugins >> Add New plugin page, click the Commercial tab, and then click the “Check for updates” button. Here is the screenshot for more details:
https://wpml.org/wp-content/uploads/2020/04/wpml-force-plugin-update-1.png

4. Please 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;
}

5. Please re-save the permalinks from the Settings >> Permalinks page by pressing the Save Changes button and see if this resolves your issue.

6. Please 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 is a doc for more details:
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

Avril 9, 2024 à 12:32 pm #15499221

arnaudD-20

it worked thanks buddy 🙂

Avril 10, 2024 à 8:35 am #15502801
arnaudD-20

Hii i get another issue can you please help me i was going to translate my all contact form7 is disappeared now from backen i found your article "https://wpml.org/forums/topic/form-disappeared-after-activating-the-wpml-contact-form-7-multilingual-plugin/" and applied steps but one popup opening see screenshot and my forms still not visible on backend can you please help me how to get it back and assist me for translation of contact forms thanks

Les nouveaux fils créés par Noman et associés à celui-ci sont repris ci-dessous :

https://wpml.org/fr/forums/topic/contact-form7-disappeared-now-from-backend/

Screenshot from 2024-04-10 14-06-54.png
Screenshot from 2024-04-10 14-00-44.png
Avril 10, 2024 à 11:14 pm #15506602

Noman
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Karachi (GMT+05:00)

Glad to hear the 500 error is resolved. For Contact Form 7 problem, it’s a different issue and will be handled separately as per our support policy. I've created new ticket for this at:
https://wpml.org/fr/forums/topic/contact-form7-disappeared-now-from-backend/

If your 500 error issue is solved, please mark this current ticket as resolved and we will continue to work on the new ticket.

Thank you for your cooperation

arnaudD-20 a confirmé que le problème avait été résolu sur 2024-04-17 01:15:51.
Ce ticket est maintenant fermé. Si vous êtes un client de WPML et que vous avez besoin d'aide, veuillez ouvrir un nouveau ticket d'assistance