Skip Navigation

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.

Sun Mon Tue Wed Thu Fri Sat
10:00 – 14:00 10:00 – 14:00 10:00 – 14:00 10:00 – 14:00 10:00 – 14:00 - -
16:00 – 20:00 16:00 – 20:00 16:00 – 20:00 16:00 – 20:00 16:00 – 20:00 - -

Supporter timezone: Asia/Jerusalem (GMT+03:00)

Tagged: 

This topic contains 9 replies, has 3 voices.

Last updated by Itamar 1 year, 4 months ago.

Assisted by: Itamar.

Author Posts
December 25, 2023 at 10:20 am #15125963

nenadG-3
Site owner

I am trying to: Keep WPML without breaking URL structure

Link to a page where the issue can be seen: Website products: hidden link

I expected to see: product page

Instead, I got: 500 error (broken permalinks)

December 25, 2023 at 1:42 pm #15126681

Christopher Amirian
WPML Supporter since 07/2020

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

I will add the first reply before this ticket is assigned to one of my colleagues.

I checked the page and it seems to be working ok with me. Please check the attached screenshot.

If the issue is there for you please do as follows:

- Go to "WordPress Dashboard > Settings > Permalinks".
- Click the "Save" button to flush the permalinks cache.
- Check the page with another browser or machine.

Thanks.

Screenshot 2023-12-25 at 17.41.56.png
December 26, 2023 at 2:48 pm #15130380

nenadG-3
Site owner

The page is now working because WPML is deactivated.

I already reset the permalinks multiple times, and the structure breaks again after several hours.

Also, I tested this on multiple browsers. The results are the same.

December 26, 2023 at 3:51 pm #15130432

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

I'll continue to help you with this issue.

500 error is a general server error. Please check for specific PHP errors to learn more about this problem. Please check this page for instructions.

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

To enable it, open your wp-config.php file and look for

define('WP_DEBUG', false);

Change it to:

define('WP_DEBUG', true);
// Enable Debug logging to the /wp-content/debug.log file
define('WP_DEBUG_LOG', true);
// Disable display of errors and warnings
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors', 0);

After this, repeat the action that causes the problem on your site. Activate WPML and trigger the error by visiting hidden link. The errors will be saved to a debug.log log file inside the /wp-content/ directory. Then please share the errors with us.

Thanks,
Itamar.

January 8, 2024 at 3:35 pm #15161465

nenadG-3
Site owner

Hi,
So this is what happens.
WPML is constantly editing my .htaccess file adding a prefix to it which causes error 500 on all pages.

This is a normal .htaccess code:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

What WPML does, it edits the .htaccess and make the code look like this:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /hr/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /hr/index.php [L]
</IfModule>

I found some articles on your forum blog that this issues has happened back in 2017 and it still happens for some of your users:
https://wpml.org/errata/htaccess-is-rewritten-with-language-folder/

I added the code suggested in this article to avoid this from happening again, but can you tell me how to resolve this permanently without the code?

January 9, 2024 at 9:09 am #15163557

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi and thanks for adding this information.

As the errata page suggests, the problem is most probably with the theme or a third-party plugin that calls the flush_rewrite_rules(true) function too often. Please proceed with the following.

I suspect that there is a collision with the theme or another plugin that might cause this problem. If possible, get your site into a minimum environment. Minimum environment means switching to a default WordPress theme like TwentyTwenty-One and no plugins activated except WPML.

First, you will need to check if the problem persists when just the theme is switched to TwentyTwenty-One (for example). If it persists, then deactivate all plugins except the WPML and its add-ons. Then please check if the problem persists. If it does not persist, start by activating the plugins one by one and check when the problem comes back, then report to me which was the culprit plugin.


**** Important! Please make a full site backup (files and DB) before you proceed with those steps****


*** If your site is live, you might want to try those procedures in a staging environment or a snapshot of your site on your local server or another server. ***

Regards,
Itamar.

January 9, 2024 at 1:03 pm #15164548

nenadG-3
Site owner

Hi,

We already have done that.

We created a staging website here:
hidden link

Where everything was disabled except the WPML plugin, and the issue persisted (with current active theme)
Then, we switched to the TwentyTwentyFour theme with only WPML active and the issue was still present. That's why I asked you about this workaround.

January 9, 2024 at 2:50 pm #15165305

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

If you need further help with this, please share the access details to your site with me. I also must have the FTP access details. I'm enabling a private message for the following reply.

Privacy and Security Policy
We have strict policies regarding privacy and access to your information. Please see:
https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/
**IMPORTANT**
- - Please backup the site files and database before providing us access. --
-- If you have a staging site where the problem can be reproduced, it is better to share access to the staging site.--

Regards,
Itamar.

January 10, 2024 at 3:11 pm #15169652

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi, and thanks for the access details.

I'm consulting our second-tier supporters about your case. I'll update you here once I have their reply.

I appreciate your patience.
Itamar.

January 11, 2024 at 9:07 am #15172878

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

Our second-tier supporter says that the code from the errata should work. We noticed that you only have one language active on your site -German. There were three languages you removed - English, Croatian, and Serbian. Please see the attached screenshot. The content of those languages should be removed if you don't plan to use them on your site in the future.

Also, there is no point in using WPML if you only have one language active. It also caused the Language URL format section in WPML -> Languages to be missing. I added French as the second language. It was on the advice of our second-tier supporter. (French was just randomly selected. The critical point is to have at least one other language.)

I accessed your site yesterday and today and can not see the problem in the .htaccess file. I understand that the problem happens randomly. But please understand that we must know the steps to replicate and debug the issue. Otherwise, we can not help.In the wp-config.php file, I activated WordPress's debug log by inserting this code:

define('WP_DEBUG', true);
// Enable Debug logging to the /wp-content/debug.log file
define('WP_DEBUG_LOG', true);
// Disable display of errors and warnings
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors',0);

In case of a PHP error or message, this code creates the debug.log file in the wp-content folder. I checked this file, and there are no errors or messages related to WPML.

So, to summarise, here are our suggestions for monitoring this case:

1. Add at least one other language.

2. Delete the content of the removed language if you don't need it. Please refer to this guide.
https://wpml.org/faq/how-to-completely-remove-a-language-from-your-site/

3. Add the code from the errata to the functions.php file of your theme.

4. Activate WordPress's debug log and monitor for any PHP errors related to WPML.

5. Let us know when you have the steps to replicate the problem. Or when you see a related PHP error.

(Some of the steps were already implemented on the staging site.)

Regards,
Itamar.

2024-01-10_17-03-05.jpg

The topic ‘[Closed] Permalink structure breaks when WPML is active’ is closed to new replies.