WPML redirects by country with slug automatic translation using Geo Redirects
Now since GeotargetingWP v3.2 , WPML it's fully integrated with GeoRedirects addon, meaning that the users of the most famous WordPress translation manager plugin can benefit from automatic slug translations on the redirects and also use language rules. Let me explain a bit more about each of these features.
Slug automatic translation
With automatic slug translation, sending users to their right language page it's pretty easy. Let's say that your website it's in English, but you also add translations in Spanish for the most popular product pages. And because you want to rank higher you translate slugs int Spanish.
So for the same product, you have https://yourdomain.com/awesome-product and https://yourdomain.com/es/producto-maravilloso
At the same time, some other pages are no translated, or slugs are not translated.
With Geo Redirects, we could detect users from Spain landing into your English pages and send them automatically to the Spanish version very easily by following these steps:
- Choose the desired country for the redirect rules. On this example "Spain"
- For destination, we simply use the dynamic placeholder to indicate that we want to redirect to the same page the user landed
- In WPML code we enter the language that the slug should be translated.
With all these settings in place, you will achieve the following scenarios:
- Spanish user lands on https://yourdomain.com/awesome-product and get's redirected to https://yourdomain.com/es/producto-maravilloso
- French user lands on https://yourdomain.com/awesome-product - nothing happens
- Spanish user lands on https://yourdomain.com/page-with-no-translation - nothing happens because there is no translation on the page
We Added a new rule that lets you filter by language code in your Redirect rules to add more power to the rules you currently have in place. So for example, you could say something like this. Redirect user if:
- Country is equal to "Spain" AND
- Language is not equal to "es"
With these settings in place you will be able to stop the redirect if the users are already in the proper language.