Geo-Redirect

The Get-Redirect shortcode for WordPress can be used to redirect automatically users from specific countries to a another web page, section or completely different website. For this shortcode to work, your website needs to be served through Cloudflare. Check below for example implementations and shortcode documentation:

Geo-Redirect Examples

We disabled the shortcode from working on this page so you can access its content & documentation. You may check the geo-redirect in action here – the page will automatically redirect to google.com

Geo-Redirect Shortcodes

Geo-Redirect Shortcode
[x3m-georedirect country="US" url="https://example.com/redirect-page"]
The shortcode can be used to redirect users from a web page or entire website to a different link based on their country location. Multiple countries can be targeted at the same time. This is ideal if you have a localised version for certain countries. Above examples targets users in the UK, users will automatically be redirected to “https://example.com/redirect-page”.

The restriction applies to the page/pages where the shortcode is implemented. If you want to make website-wide available, consider implementing the shortcode in a footer widget for example.

Geo-Redirect Documentation

First, the most important requirement for this shortcode to work is for your website to be served through Cloudflare (free plan works). Cloudflare offers a geo-location data which is used by our shortcode to activate the redirect for specific countries. By default this service is activated in Cloudflare, but in case your website does not apply the redirect correctly to specific countries, check for the Cloudflare’s CF-IP Country header to be active (enable the “Add visitor location headers” Managed Transform in your Cloudflare dashboard).

Here are the shortcode option settings available for Geo-Blocking:

Shortcode Settings Details
country=”US” used to include the country to activate the redirect to your page or website. Multiple countries can be included in this list, listing them comma separated (ex: “US, JP, FR”).
The countries listed should use the 2 letter/alpha-2 notation
url=”link here” used to set the web link to which the visitors from selected countries will be redirected.