0

I’ve got a pretty weird behavior on my site that I’d like to resolve.

From time to time (no recognized pattern), my site shows a 500 error, on the front pages or on some admin pages. When this 500 error shows on the front pages, the admin pages are still usable.

I’ve found by chance a way to fix this: by going to the Permalinks settings page (/wp-admin/options-permalink.php) without submitting anything! The simple fact of going to this page resolves the error.

I’ve noticed that options-permalink.php is calling this url:

https://public-api.wordpress.com/rest/v1.1/me?http_envelope=1&fields=ID%2Cusername

with this response:

{"code":200,"headers":[{"name":"Content-Type","value":"application\/json"}],"body":{"ID":[my_id],"username":"[my_username]"}}

But I don’t know how there could be a relationship between the 2...

FYI, I’ve recently migrated from one hosting provider to another so it may be a configuration problem on the server because there wasn't any error back then.

Thanks for your time! Any help appreciated :-)

Update after @vancoder suggestion: I made a diff between the 2 versions of .htaccess file before and after the problem occurs:

Working site:

RewriteBase /
RewriteRule . /index.php [L]

Non working site:

RewriteBase /fr/
RewriteRule . /fr/index.php [L]

My site is multilingual based, but with only the french language set for now. Do you know which plugin could be the culprit (WPML? Really Simple SSL?) ? Have any of you encountered the same problem before?

FYI, here's the list of all my activated plugins:

  • Contact Form 7
  • Contact Form 7 to Hubspot
  • Cookie Notice & Compliance for GDPR / CCPA
  • Elementor
  • Facebook for WooCommerce
  • HubSpot All-In-One Marketing - Forms, Popups, Live Chat
  • HubSpot for WooCommerce
  • ImageMagick Engine
  • Jetpack
  • Porto Theme
  • Really Simple SSL
  • Site Kit by Google
  • WooCommerce
  • WooCommerce Google Analytics Integration
  • WooCommerce Multilingual
  • WooCommerce Shipping & Tax
  • WooCommerce Stripe Gateway
  • WordPress Zero Spam
  • WPML Media
  • WPML Multilingual CMS
  • WPML String Translation
  • WPML Translation Management
  • WP Super Cache
  • WPvivid Backup Plugin
  • Yoast SEO
  • Yoast SEO Multilingual

Thanks again for your help!

8
  • 2
    "Random 500 errors" is most likely a hosting problem (the server just reached its capacity). In your position I would collect some data (when has this happened at which pages) and then contact your hosting provider with that info. They can usually check the logs to see performance spikes or similar.
    – kero
    Feb 9 at 15:39
  • Thx for your comment. Contacting my hosting provider is indeed an option, but my question here concerns more specifically the options-permalink.php call. (and fyi, my site is brand new, there can't be any performance spike at all :-) )
    – claire_
    Feb 10 at 8:19
  • 1
    Is your new host WordPress.com? If so, you should direct any support questions to them. Feb 10 at 10:08
  • No, the site is not hosted on wordpress.com.
    – claire_
    Feb 10 at 10:28
  • 2
    Just visiting options-permalink.php fires flush_rewrite_rules() (without you doing anything else). This will rewrite your site's htaccess file. So I'd guess something is writing malformed or unsupported code to your htaccess - possibly a plugin. Next time this happens, I would take a look at your htaccess file, and compare it to how it looks when the site is healthy. You might find a clue there.
    – vancoder
    Feb 17 at 23:31
1
+50

Looks like it might be your WPML.

See here: https://wpml.org/forums/topic/wpml-add-rewritebase-en-in-htaccess/

For posterity, the summary of this page is as follows:

Problem: Some wrong settings caused an issue with "Use directory for default language". A 500 error was showing. Solution: The client reports here that pressing the 'Reset Settings' button in WPML -> Languages probably solved the problem.

1
  • Thanks again ! Pressing the 'Reset Settings' button in WPML -> Languages has indeed solved my problem...
    – claire_
    Feb 19 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.