I am using the "Different languages in directories" option with the "Use directory for the default language" checked.
The main language is French with a custom language to create the slug /fr-fr/.
So, my main domain is always showing the language prefix domain.com/fr-fr/.
The issue I am facing is that when a user types a URL without the prefix, it does not redirect to the main language prefix. For example, domain.com/about/ should redirect to domain.com/fr-fr/about, but this is not the case. The redirection only takes place when we go to a post or CPT URL, for example, domain.com/blog/post-1. In this case, it will redirect to domain.com/fr-fr/blog/post-1.
How can I solve this issue to always have a language prefix in my URLs, even when we enter a URL without a language prefix?
I checked my installation and it works as expected. You can check here:
hidden link
Try to use:
hidden link
It redirects correctly. This shows the default WPML behavior is ok and something is preventing the redirection on your website.
- IMPORTANT STEP! Create a backup of your website. Or better approach will be to test this on a copy/staging version of the website to avoid any disruption of a live website.
- Go to "WordPress Dashboard > Plugins" and deactivate all plugins except WPML and its add-ons. (Also deactivate WPML CMS Nav and Sticky links)
- Check if you can still recreate the issue.
- If not, re-activate your plugins one by one and check the issue each time to find out the plugin that causes the problem.
Hi Christopher, Hope there is a solution to add there. I tried several modifications in the htaccess but it brokes the admin site and images link so i reverted back to normal.
Looking forward hearing from you regarding this issue.
Regards.