Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
If you're experiencing server errors on your site that make it very slow and often go away when you reload the page, we have identified a potential solution.
Solution:
First, you might be facing an issue that requires adding specific code to your theme's functions file to correct rewrite rules:

1. Using FTP, navigate to `/wp-content/themes/your-theme`.
2. Open the `functions.php` file for editing.
3. Add the following code and then save the changes:

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;
}

For more details, please refer to the documentation: https://wpml.org/faq/why-is-htaccess-getting-overwritten-with-the-language-folder-on-my-wpml-website/.

Additionally, to identify the exact cause of the errors, enable debugging in your site.

To enable it, open your wp-config.php file and look for define('WP_DEBUG', false);. Change it to:

define('WP_DEBUG', true);

To enable the error logging to a file on the server, you need to add yet one more similar line:

define( 'WP_DEBUG_LOG', true );

The errors will be saved to a debug.log file inside the /wp-content/directory.

https://wpml.org/documentation/support/debugging-wpml/

If this solution does not apply to your case, or if it seems outdated, 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. Should you need further assistance, please open a new support ticket at WPML support forum.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 23 replies, has 0 voices.

Last updated by Andrey 1 week, 1 day ago.

Assisted by: Andrey.

Author Posts
April 14, 2025 at 2:13 pm #16930012

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

Thank you for your feedback.

Deprecated: Automatic conversion of false to array is deprecated in /home/hipstorb/public_html/wp-content/plugins/wpml-sticky-links/classes/class-wpml-sticky-links.php on line 19

This is a known notice and will be handled in future releases. It should be harmless to your website.

I mean looks bad if new customers are checking our webpage (which is admittedly, sadly not a crazy amount daily, but.. not a great impression). Buuut, still looks bad 😀

Please add the following line to the config.php to hide error displays on the site and log them only to debug.log.

define( 'WP_DEBUG_DISPLAY', false );

The internal server error should reveal the actual fatal error in the debug.log. The warnings should be harmless.

Can you try the following?

1. Make sure that you have the following in the config:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

2. Remove the debug.log file in /wp-content/debug.log, if it exists.

3. Make the internal server error happen.

4. Check the debug.log file and share its content here.

5. Share the content of the .htaccess file at the moment of the error, located in the root of your installation (where config.php).

Before making any changes, please ensure that you back up your database first.

April 16, 2025 at 5:10 am #16936562

stevenK-22

Hello Andrey!

Okay, cool - I have all three of these now in the wp-config:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

I checked for the debug.log file in the wp-content folder, and didn't find one. Oh wait..I do see it, okay deleteing.

Backed up my database (and whole site) 🙂

Let me try to get that content now...

April 16, 2025 at 1:25 pm #16939155

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

Thank you for your feedback.

I will be waiting for the debug.log content.

April 16, 2025 at 3:29 pm #16939879

stevenK-22

Zdrave,

yea, weirdly i haven't got it to proc an error yet! Like... errr... it was doing an error EVERY time/every page before. ever since i de-activated it, then fixed a bunch of the pages/etc., and re-activated it now, it's not thrown an error... let me try again. Or do you not need it to throw an error, and i should just send the debug log anyway?

April 16, 2025 at 3:35 pm #16939925

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

We need to capture the entry in the log that occurs when you receive the error. This should help us understand what it is related to. I wonder if your steps fixed it.

April 16, 2025 at 4:06 pm #16940145

stevenK-22

Just tried about 20 more pages... and... no errors!
soo weird. many of the woo-commerce products before hadn't translated properly (e.g. about 7 products were missing, many of the product slugs were incorrect, product properties were incorrect for some reason (pricing, or other variables, etc.) there were some other errors in the translation copy from EN to BG language). When i disabled WPML, i just went in and manually fixed every product, variables, slugs, etc., then i re-enabled.. .maybe something about the differences was throwing the errors?

April 17, 2025 at 12:30 pm #16943923

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

I cannot say for certain what happened, but I am glad it works now. I assume that resaving the products fixed some data in the database that might have been corrupted.

April 17, 2025 at 4:37 pm #16945250

stevenK-22

Okay mate, thanks for sticking with me... happy it sort of "fixed itself"
Should i turn the deubbing etc back to:

define( 'WP_DEBUG', flase );
define( 'WP_DEBUG_LOG', false );
define( 'WP_DEBUG_DISPLAY', false );

?

cheers,
Steve

April 17, 2025 at 5:04 pm #16945414

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

Hey Steve,

Yes, you can turn it off as you showed. If you experience this issue again or encounter any errors on the site, you can turn it back on and check the logs to identify what might be causing the problem. You are always to open a new support ticket if needed.