Home›Support›English Support›[Resolved] After setup default language the link to that language doesn't work
[Resolved] After setup default language the link to that language doesn't work
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:
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.
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?
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
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
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.
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?
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: