Skip Navigation

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

Problem:
The client is experiencing 404 errors on language-specific /wp-login.php pages when using the WPML plugin with Nginx. This issue occurs for certain languages like Hungarian and Thai.
Solution:
If you're encountering similar issues, we recommend checking your server's configuration. Since Nginx does not use the

.htaccess

file, you need to update your Nginx configuration to include specific rewrite rules for each language. Here is the rewrite rule you should add:

rewrite ^/xx/wp-login.php /wp-login.php break;

Replace

xx

with the appropriate language code. For example, if your site supports English, German, and French, you should include:

rewrite ^/en/wp-login.php /wp-login.php break;

rewrite ^/de/wp-login.php /wp-login.php break;

rewrite ^/fr/wp-login.php /wp-login.php break;

For detailed guidance, please refer to our documentation on translating WordPress login and registration pages.
If this solution does not resolve your issue, or if it seems outdated or irrelevant to your specific case, 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. Additionally, please feel free to open a new support ticket for further assistance 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.

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by Bruno Kos 4 months ago.

Assisted by: Bruno Kos.

Author Posts
September 11, 2024 at 10:13 am #16165715

Laszlo Szalvak

Background of the issue:
I am one of the developers of Nextend Social Login. Recently, one of our users encountered a problem where our plugin started throwing 404 errors for some of the WPML language-specific /wp-login.php pages. We advised the customer to use two of our settings (OAuth redirect uri proxy page and Page for register flow) to handle its flow over normal pages that WPML can translate just fine. However, I noticed that some languages throw 404 errors even on the WPML sandbox site.

Steps to reproduce the problem:
1) Add the 'Hungarian' and 'German' languages in WPML
2) WPML > Languages > Language URL format - choose 'Different languages in directories'
3) WPML > Settings > Login and registration pages - enable both 'Allow translating the login and registration pages' and 'Show Language Switcher on login and registration pages'
4) Open the /wp-login.php page in Incognito mode, e.g., hidden link
5) From the language switcher, choose the 'German' (Deutsch) language
6) The German /wp-login.php loads fine: hidden link
7) From the language switcher, choose the 'Hungarian' (Magyar) language
8) You will be redirected to the Hungarian wp-login.php page, but it will throw a 404 - File not found error: hidden link
(Other languages like Thai are also affected)

Symptoms:
404 - File not found error when accessing language-specific /wp-login.php pages for certain languages like Hungarian and Thai.

Questions:
Why do some language-specific /wp-login.php pages return a 404 error?
Is there a known issue with WPML handling language-specific /wp-login.php pages?
Are there any additional settings or configurations needed to prevent 404 errors for language-specific /wp-login.php pages?

September 13, 2024 at 6:41 am #16174110

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+01:00)

This is escalated to our 2nd tier team and may take some debugging time, I'll get back to you as soon as I have any news or questions for you.

September 13, 2024 at 12:39 pm #16175483

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+01:00)

It appears your website is running on Nginx. Could you please review the following documentation link? [Check this link](hidden link).

For translating the login and registration pages, the rules are typically stored in the `.htaccess` file. However, since Nginx does not use the `.htaccess` file, you will need to update the Nginx configuration to include the appropriate rewrite rules. If you do not have the necessary permissions to make these changes, please reach out to your hosting provider for assistance.

Here is the rewrite rule to add:

rewrite ^/xx/wp-login.php /wp-login.php break;

Replace `xx` with the appropriate language code.

For instance, if your site supports English, German, and French, the Nginx configuration should include the following rules:

rewrite ^/en/wp-login.php /wp-login.php break;
rewrite ^/de/wp-login.php /wp-login.php break;
rewrite ^/fr/wp-login.php /wp-login.php break;

Note: If your site uses a different domain per language or adds the language name as a parameter in the URL, no additional configuration is needed.

September 14, 2024 at 8:07 am #16178409

Laszlo Szalvak

Hi Bruno!

Thank you for the extra information!

I marked this topic as resolved, but I couldn't really confirm this actually resolves the error, as I used one of the "Compatibility Partner testing environments" that your offer for plugin developers here:
https://wpml.org/account/compatibility-dashboard/
So I assume only you could add the rewrite rules to the automatically created testing environments.

But I checked WordPress > Tools > Site Health > Info > Server and I can see these sandbox sites are running on nginx/1.22.1 indeed. So I assume your suggestion would work.

Either way, thank you very much for your reply once again, I will forward your documentation to our customer and I will also include this information to our WPML compatibility documentation.

Have a nice weekend!

Best regards,
Laszlo.