Skip to content Skip to sidebar

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

Problem:

The client is experiencing an issue where the URL *****.group/real-estate/de redirects incorrectly to a specific post instead of opening the German version of the website as intended. This problem persists even after setting the option 'Use directory for default language' in WPML settings.

Solution:

We recommend the following steps to resolve the issue:

1) Ensure you are using the latest version of WPML. If not, upgrade to the latest version (e.g., 4.7.6 series) after taking a full site backup.
2) Navigate to WPML >> Languages >> Language URL format and resave the settings.
3) Go to Settings >> Permalinks and resave the settings without making any changes.
4) Clear all types of caches including page, server, and CDN caches.
5) If the issue persists, create a file named wpm-root.php in the root directory of your site and add the following code:

<?PHP
header('Location: https://siteurl.group/real-estate/de');
exit;
?>

6) In WPML >> Languages >> Language URL format, enter 'wpm-root.php' as the HTML file and save the settings.
7) Again, go to Settings >> Permalinks and click Save Changes without making any changes.
8) Clear all types of cache again.

For more details, refer to the following documentation links:

If this solution does not resolve your issue or seems irrelevant due to being outdated or not applicable to your case, we highly recommend checking related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the problem persists, please open a new support ticket.

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 5 replies, has 1 voice.

Last updated by Bigul 1 month, 1 week ago.

Assisted by: Bigul.

Author Posts
July 14, 2025 at 8:44 pm #17235683

rogerT-10

Background of the issue:
We set German as a default language on our subfolder WordPress installation (folder name is real-estate).

Symptoms:
When someone types the URL swissmarketplace.group/real-estate/de, it gets redirected to hidden link instead of opening the German version of the website. I even set the option in the language settings Use directory for default language but in that case home url becomes swissmarketplaces/real-estate/de and get redirected as well to the same url hidden link

Questions:
Why does the URL swissmarketplace.group/real-estate/de redirect incorrectly?
How can we configure WPML to recognize the default language directory URL correctly?

July 15, 2025 at 5:41 pm #17239146

Kor
WPML Supporter since 08/2022

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Thanks for contacting us. By default, the primary language does not include a language directory in the URL. That’s why your German primary language page appears as:
hidden link

However, if you’d prefer to display the directory for the default language as well, you can follow the method explained here:
https://wpml.org/documentation/getting-started-guide/language-setup/directory-default-language/

July 16, 2025 at 12:47 pm #17242008

rogerT-10

Thank you for your answer. I test the option Use directory for default language by enabling the checkbox but then default URL hidden link got error and leads to the post. Do I need to set something additionally? And what is the best set up for the subfolder installation because real-estate is subfolder on our main installation with separate WordPress set up and plugins. I don't think that this set up use directory for default language works fine for subfolder installations. Basically we just want to have both URLs hidden link and hidden link to lead to the German version of the website because a lot of URL are still hidden link

July 16, 2025 at 5:15 pm #17243249

Bigul
WPML Supporter since 01/2013

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

Thank you for the updates. This issue may be happening due to the older version of WPML (4.6.15 series). To check if that’s the cause, please follow these steps after taking a full site backup:

1) Upgrade to the latest version of WPML (4.7.6 series)
2) Visit WPML >> Languages >> Language URL format
3) Resave the settings
4) Visit Settings >> Permalinks
5) Resave the settings
6) Clear all types of caches

Please note that you may have to visit Plugins >> Add Plugin >> Commercial tab and click on the *Check for updates* button to get the WPML automatic upgrade links of the latest version. This step will help us refresh the installer caches.

--
Thanks!

Bigul

July 18, 2025 at 8:45 am #17249075

rogerT-10

Hello,

We did the plugin update, permalinks are reset, cache is cleared, redirections are checked, .htaccess file checked but we still have redirection from swissmarketplace.group/real-estate/de to hidden link (custom post type). German language is set to be default (as it should) but we want to allow the access when someone type swissmarketplace.group/real-estate/de and be redirected to the default version of the website (German). The problem here is that WPML doesn't redirect the URL from /de to / (root) for some reason and allow user to reach the website properly. I think this was the case in previous versions (we still have old version of the website saved and that's the case there). I gave up from idea to use default language directory because that doesn't solve our problem in the first place. We with to have the set up where German language will be default and where /de can be redirected to the default (main) version of the website which matches with the German version in the first place. Is this can be done with WPML or not? And which set up we should have here?

July 18, 2025 at 2:42 pm #17250800

Bigul
WPML Supporter since 01/2013

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

Thank you for the updates. Please try the following steps after a site backup and make sure the issue exists or not.

1) Create a file named wpm-root.php in the root directory of your site
2) Add the following code to it:

<?php
header('Location: <em><u>hidden link</u></em>');
exit;
?>

3) Go to WPML >> Languages >> Language URL format
4) Scroll to the "Use directory for default language" section
5) Enter wpm-root.php as the *HTML file*
6) Save the settings
7) Go to Settings >> Permalinks and click Save Changes (without making any changes)
8) Clear all types of cache (page, server, and CDN)

Refer to the following doc links for more details:

hidden link

https://wpml.org/documentation/getting-started-guide/language-setup/directory-default-language/#redirect-the-root-domain-to-the-default-language-directory

https://wpml.org/documentation/getting-started-guide/language-setup/directory-default-language/

--
Thanks!

Bigul