Skip Navigation

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

Problem:
After updating the server to Nginx, the translated login page shows a 404 error. This issue arises because Nginx does not use the .htaccess file, which typically contains rules for handling translated pages.
Solution:
To resolve this, you need to add specific rewrite rules to your Nginx configuration. Here are the steps:
1. Open your Nginx configuration file.
2. Add the following rewrite rules:

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

Replace 'xx' with the language code. For instance, if your site supports English, German, and French, you should add:

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;

3. Save the changes and restart Nginx.
If you do not have the permissions to modify the Nginx configuration, please contact your hosting provider.

If this solution does not apply to your situation, or if it seems outdated, we recommend checking the 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 issues persist, 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.

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Nicolas V. 7 months ago.

Assisted by: Nicolas V..

Author Posts
May 27, 2024 at 1:58 pm #15674572

francescoS-56

Background of the issue:
I recently updated my server to use Nginx.I am trying to ensure that the translated login page on WPML functions correctly. There are other errors that may or may not be related, some js are being blocked because the request is made using http instead of https, that didn't happened before the update to nginx

Symptoms:
After updating the server, the translated login page at hidden link shows a 404 error.

Questions:
How can I configure Nginx to correctly handle the translated login page for WPML?
Is there updated WPML documentation available that does not return a 404 error?

May 27, 2024 at 3:21 pm #15674956

Nicolas V.
Supporter

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

Timezone: America/Lima (GMT-05:00)

Hello,

As discussed I converted our conversation into a ticket. Please let me know if you managed to create the redirect rule in your htaccess and if it solved the issue.

Thanks,
Nico

May 27, 2024 at 7:05 pm #15675630

francescoS-56

Hello Nicolas, now it shows another error, file not found. Did your team find the Nginx documentation?

Screenshot from 2024-05-27 15-03-40.png
May 28, 2024 at 11:53 am #15678161

Nicolas V.
Supporter

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

Timezone: America/Lima (GMT-05:00)

Hello,

Here is the full documentation. I made a mistake, you don't have to place that code inside your htaccess file but inside the ngnix settings:

Translating Login and Registration Pages for Sites that Use nginx
If your site uses nginx and your language URL format is set to Different languages in directories, you may see a 404 error when trying to access a login or registration page in a secondary language.

To avoid this, you will need to adjust some settings.

Server Requirements for Sites that Use nginx
Rules for translating the login and registration pages are usually stored in the htaccess file. Because ngnix does not access this file, you will need to modify the nginx settings to add the following rewrite rules. If you do not have the permissions to do so, please contact your hosting provider to make these changes.

The rule to add is:

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

Where xx is the language code.

For example, if the user has English, German, and French languages active on their site, the nginx rules would be:

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;

If your language URL format is set to A different domain per language or Language name added as a parameter, no additional configurations are required.

May 28, 2024 at 7:10 pm #15680511

francescoS-56

Hi Nicolas, that solves it. Thanks for the support.