If you need to redirect an user based on their location there are several ways to do it. Today Im going to explain you how to do it with the Geo Redirects WordPress plugin.
With the Geo Redirects plugin creating redirections it’s really easy. And the cool thing is that the plugin is so powerful that you can even use it for regular redirections where no geotargeting is needed.
To create a redirection you just need to worry about 3 sections:
- Title: Simple add a name to your redirection to identify it later
- Rules: Here you can set the different rules that need to pass the user in order to be redirected. You can for example only redirects users coming from certain pages, or coming from Search engines. Of course you could choose geo rules such as country, city, state or regions.
* More about rules later
- Options: On this section you set the redirections options, starting from the destination URL where you want the user redirected and with more advanced options like if you want to redirect the user just the first time or every time he visit your page.
Once you fill everything with your desired values, simple hit Update and your first redirection will be ready!
Most of the users need simple redirections like only redirect users in front page that are from certain country. But if you need more complicate criterias the Geo Redirects plugin got you covered! The complete lists of rules that you can combine using AND / OR groups listed below:
- Redirect based on geolocation
- Redirect on specific pages, templates, posts, etc
- Filter user from search engines
- Filter users that never commented
- Filter users that arrived via another page on your site
- Filter users via roles
- Redirect depending on referrer
- Redirect to logged / non logged users
- Redirect or not to mobile, desktop and tablet users
- Redirect or not to bots / crawlers like Google
- Redirect or not depending on query strings EG: utm_source=email
- Redirect depending on post type, post template, post name, post format, post status and post taxonomy
- Redirect depending on page template, if page is parent, page name, page type
Basically all the rules set using AND button needs to be true in order to perform a redirect. Based on the screenshot above the user needs to be in the Cart page, not be logged and come from United States of America. If any of those three is not true the user won’t be redirected
Any of the rules needs to return true. So you can say for example user needs to be in Cart page or user needs to come from United States. If any of those rules is true the user will be redirected.
Here you you can choose between redirecting the user (if he passed the rules) everytime he visits the page, or just one time, or just one per session (if the user closes the browser , he will be redirect again). Also you can whitelist IPs in case for example you don’t want some users to be redirected. And you can choose whether or not to redirect crawlers/bots and set also the redirection code.
The Geo redirect plugins is a powerful redirection tool that can be used in many ways and not only for redirecting users form certain country or location. The best thing will be if you try it yourself.