Quick Usage Guide

You are here:

How to create a Geo Redirection

Creating your first redirection is pretty easy. They work as a normal post or page, you can set them to draft, publish, schedule or send it to trash. Each redirection is based on 3 things:

  • Title: Just give a name to your redirection
  • Redirection rules: Here we define a set of rules that will determine if the redirection it's performed or not.
  • Redirection options: The different settings for the redirection being the main field, the destination url.

Redirection rules

redirection rules

On this section you can combine multiple rules between each other and is the most powerful part. You can create group of rules using AND or OR buttons.

For example on the screenshot above the redirection will be performed only if the user is located in the cart page, and is not logged in and his country is US. If those three statements are true the redirection will be performed.

That rule for example could be extended with an OR group of other rules and say for example redirect if the user is from Canada. So either the user is from Canada OR the three rules above match, the redirection will be performed.

You need to be careful to not overlap rules. For example if you do the following to redirect all user from US except the ones that are in contact page and you do the following:

rule 1

On this example if the user is from US and he is on the Contact page will be redirect because rule group #2 overwrite rule group #1. Instead you need to add both rules using the AND button:

rule 2

It's important to add geo rules as the last rule of each group. That way is a prior rule fails, the geo rule won't run and you will save requests

Redirection Options

redirection options

On this section you find the different options for this redirection:

  • Destination URL: Is the url that you are redirecting the users to. You can use dynamic placeholders in here.
  • One time redirect?: You have three options to choose. "No" will redirect users every time. "Yes" will redirect users one time a save a cookie to never redirect them again unless the user clear his cookies."Yes, once per session" will create a cookie that when the user close the browser will be deleted and next time he visits the site will be redirected again.
  • Exclude Search engines: By default you don't want to redirect search engines, and just do it to user.
  • Redirection code: Which status code to use on redirection. By default it's a 302 permanent redirect.
  • Ip whitelist: You can add as many IPs as needed to be excluded from the redirection.

Placeholders

On the destination url field you can use multiple placeholders in order to create dynamic urls.

  • {{country_code}} Two letter iso code
  • {{state_code}} Two letter state code
  • {{zip}} Zip code
  • {{requested_uri}} Original requested url. Eg: http://geotargetingwp.com/geo-redirects
  • {{requested_path}} Original requested path. Eg: geo-redirects
Examples of dynamic urls

Let's assume that the origin url is http://domain.com/category/news/ , the country is United States and State florida. Some examples are:

/{{country_code}}/{{state_code}}/{{zip}}?path={{requested_path}}&url={{requested_uri}}

Will generate http://domain.com/us/fl/33166?path=category/news&url=http://domain.com/category/news/

{{requested_uri}}/{{country_code}}

Will generate http://domain.com/category/news/us