Website geo-targeting and caching – can you have both at once?

As you begin to build more complex websites with different client needs, one thing you may stumble upon is the issue of making geo-targeting play nicely with caching.

For instance, you may have a website or a client website that needs to redirect users based on their location, perhaps to different pages, translations or subdirectory versions of your website. At the same time, caching should almost always be enabled on any websites for performance and stability. Yet, when you have both of these functions occurring on one site, a problem arises.

The Problem

When a user visits your website and is the first to do so, your caching plugin will jump into action and start caching your content based on this user’s visit. Copies of any of the pages they visit will be generated and cached, then tucked away to quickly serve to the next visitor, making page load times for all subsequent users lightning-quick!

Unfortunately, one of the details that generally gets included in that cached version is the location of that original user. Therefore, all subsequent users will be presented with the content designed for that user’s particular language or locale, rather than being geo-targeted to their own correct version.

So how can you have your cake, and eat it too?

The Plugins

If you’ve already had to set up either caching or geo-targeting on your website, and are just now attempting to set up the other of the two, your first port of call has probably been to check out or trial a few different plugins.

There are many geo-targeting plugins for WordPress, and while they all may offer a great number of features, not all of them are created equally when it comes to their ability to play well with sites that have caching enabled.

In this case, caching plugins are generally not the most problematic side of the equation, and you can probably continue to use whichever caching plugin you prefer. It is more up to the geo-targeting plugin to offer the compatibility with caching that you’re after. But in saying that, some caching plugins do have built-in support for geo-targeting too.

The Solution

Fear not! There is indeed a solution. Several in fact, in theory.

Through our own experience, trials, and tribulations, we’ve discovered the following combinations of geo-targeting and caching plugins that have found a way to make it work for the sake of the kids web developers. Granted, all of the below are in regards to WordPress only. If you’re a Joomla, Magento, CraftCMS, Drupal (or any other website CMS/software) user, you’ll, unfortunately, need to keep looking.

Option 1: Any* Caching Plugin & Geotargeting WP

Geotargeting WP is a leading plugin in its field and offers affordable functionality with a wide range of control. In their knowledgebase, you will find a whole article dedicated to the discussion of caching compatibility. They recommend pairing their plugin with WP Rocket for 100% compatibility, but you’ll also note down the bottom of the page that they mention they also offer an ajax mode, which makes their plugin work with pretty much any caching plugin of your choice.

Option 2: WP Rocket & Any* Geotargeting Plugin

A plugin called Country Caching for WP Rocket (CC4R) has been created as something of an extension to WP Rocket. When installed alongside WP Rocket, it offers the required functionality to make it compatible with geo-targeting plugins. This option is a bit more complex to set up however, so if you are not an experienced user, this might not be your best option.

Important Note

* When we say “any” above, it really means “almost any”. From our findings, most plugins will play nice when paired with the corresponding plugin mentioned, but we would still advise you to check in with the developers of both of your chosen plugins prior to purchase, just to be certain that you won’t have any compatibility obstacles. There are so many plugins out there that we could not possibly test and verify them all.

We hope this information has been useful and saves you a bit of time digging around for answers. With one of the two options above in place on your website, you should be caching and geo-targeting simultaneously in no time!

That’s it from us! As always, if you have any questions about this post or our shared hostingVPSreseller or dedicated server plans, simply call us on 1300 MY HOST (694 678) during business hours, or submit a ticket through our Support Portal and one of the crew will be in touch!

Get tips & insights
direct to your inbox.

Sign up to our newsletter to get the most from your website hosting with insider tips, tools and guides plus 10% off your first invoice!

Have more questions
on Hosting?

Simply call us on 1300 MY HOST (694 678) during business hours, or submit a ticket through OnePanel and one of the crew will be in touch!

Get in touch