The Ultimate Guide to IP Redirection Based on Geolocation

Download Now: 25 Free HTML & CSS Hacks
Elisabeth Wieser
Elisabeth Wieser

Published:

Recently, I tried to order some furniture online. I picked out the piece I wanted, went to my shopping cart, entered all my details, and was about to pay when suddenly a warning popped up: This item is not available in your country.

people in an office using geo based IP redirection on their website

a checkout page telling the visitor that this order cannot deliver to their region

I was frustrated that there wasn't any clarification about this earlier in the process. Maybe they offer other products that ship to my location, but to be honest, I will never know. I didn’t want to purchase anything else.

You might be thinking, "Wow, that’s harsh!" And you would be right. But just like me, many customers out there will react the same way to being denied a purchase. A great customer experience is essential. It directly translates into your conversion rate and, therefore, into your sales. With a saturated market of online stores, your customers don't rely on you — you depend on them.

One way to ensure this won't happen to you and your business is by redirecting your customers based on their geolocation. Offering your customers content in their preferred language, providing your prices in their local currency, and showing them only products that will actually ship to their country are some advantages of geo redirection based on your customer's country or city.

Download Now: 25 HTML & CSS Hacks [Free Guide]

After all, there is a reason why the big players like Apple, Amazon, and Coca-Cola use geo redirection in their marketing strategy. It doesn't only help your bounce rate — it directly translates into conversions.

However, implementing a geotargeting strategy without prior knowledge is not a walk in the park. If done wrong, it can prevent your website from being properly indexed by search engines.

To ensure that your SEO won't suffer any impact, this post will discuss what location targeting and redirection are, why you should (or shouldn't) use them, how Google treats this subject, as well as different ways of redirection and how to implement them when developing your website.

How does IP redirection work?

Let's say we have a website, awesome.com, that is getting a lot of traffic worldwide. We want to offer a more personalized experience to our global audience and decide to customize our website for different locations. To do this, we need to learn what countries our visitors are coming from.

This is where the IP addresses come in. An IP (which stands for “Internet Protocol”) address consists of a series of numbers unique to a device or network. IP addresses allow us to identify the country or even city of a visitor.

The IP address is then matched against a database of IP addresses and locations so we can automatically redirect our visitors based on this information. This is called a geo IP redirect, geolocation redirect, or location-based redirect.

There are several different ways a redirection can work. The best method for you will depend on your needs, your goal, your website’s structure, and/or your marketing strategy. Let's take a look at the different methods.

  1. Content: If you only want your content to be specific to your users' locations, a Smart Content Option might be the right way for you.
  2. Subdomains and subdirectories: The most common way to redirect your users based on geolocation is by working with subdomains or paths. If we want all our awesome.com website visitors from Germany to get redirected, we send them to de.awesome.com or awesome.com/de.
  3. TLD: Top-level domains allow you to work with country-specific domains (awesome.de). However, obtaining and maintaining TLDs requires more infrastructure while only targeting a single country. Multiple TLDs are rarely used in practice, as they might confuse users. Therefore, most companies purchase a country-code TLD for their primary market and geo-redirect those to subdomains or subdirectories.
  4. Default: Another alternative is to set a default website for your international visitors. If our business is located in the US, we can redirect everyone outside of the US to global.awesome.com.

IP Redirection Challenges

While redirecting visitors has its benefits which we’ll discuss soon, implementing it can be tricky. If you are not careful when deploying, you could risk hurting your SEO and your customer experience.

While some customers will perceive being redirected to a website in their language or currency as a good experience, others might find this behavior unexpected. In some cases, your visitors might want to visit your main website and get frustrated when they’re suddenly redirected elsewhere.

Similarly, if your users are traveling while using your website or product, suddenly having content displayed in a different language to their home country is annoying.

Customer experience issues can be easily detoured by ensuring your language settings or geobased websites are visible and easy to navigate. However, when it comes to your SEO, there are also some pointers to keep in mind.

The main issue with IP redirection is indexing: If Google can't crawl your website, all your hard work will be for nothing. This happens when it only encounters redirects for sites outside the US because mostly Googlebot uses a US-based IP. To make sure Google has access to them, websites have to be reachable for US IPs.

IP Redirection Benefits

At this point, it’s reasonable to ask: "Should we even redirect our users?" Redirection is a lot of work and can be a source of errors.

However, there are two excellent reasons for geo redirection. They are:

Improved User Experience

While a small percentage of users might be confused about not landing on the main website, your overall UX will improve greatly. IP redirection allows you to give your product or website a more personalized touch. Seeing content in one’s own language or showing area-specific content makes users feel closer to your product or service.

Geotargeting also allows you to offer prices in your user's currencies and show them area-specific store locations. Besides making the website easier to understand and navigate, this also increases your users' trust in your business.

SEO

An improved user experience is great. However, people aren't the only ones who visit your website. Search engine crawlers like Googlebot will also access your site to index your structure and content.

As mentioned, this can be the downfall of your IP redirection. However, if you do it right, it could actually help your international SEO. It only hurts your optimization strategy if crawlers can't access your redirected websites.

But don't worry, there is a way to ensure this won't happen. It is crucial to implement a 302 temporary redirect so search engines know where to send their crawlers correctly. They then can accurately index your website. (This is different from a 301 redirect, which suggests a permanent redirect. More on this later.)

Moreover, redirects preserve your "old" website’s search rankings. Therefore, your high authority will translate to your geobased redirects. Your geobased sites will then perform as well as your main website.

If you are still unsure whether an IP-based redirect is a good idea, let's check what Google has to say about it.

Google's View On Redirection

Many articles out there will tell you that Google doesn’t like redirections. However, they all highlight the same issue: Google can't access your redirected sites. Let's take a closer look at what Google says about redirections.

Regarding redirection based on geo-location, Google talks about "locale-adaptive pages." This means that your site shows different content based on user country.

Google might have a problem with indexing, or ranking your various sites, as their crawlers appear to be located in the United States. Furthermore, the bot sends HTTP requests without “Accept-Language” in the request header.

Suggested solutions by Google

Even though Google can have issues with your geo-redirected sites, there are measures you can undertake to ensure those problems won't affect you, as suggested by Google.

Treat crawlers like users.

Even though Googlebot's IP addresses are primarily US-based, some are based outside the United States. When Googlebot appears to come from a certain country, it's essential to treat it like you would a user from that country.

In other words, if you block American users from accessing a geo-specific site but allow German users to visit, you should also block the US-based Googlebot and allow the German Googlebot to access.

This is where top-level domains (awesome.com, awesome.de, etc.) or subdomains/subordinaries (de.awesome.com, awesome.com/de) come in handy. They are the most straightforward way to tell Google your targeted country, and it will understand that you are redirecting your visitors based on their location. If crawlers from Germany land on awesome.com and get redirected to awesome.com/de, it's reasonable for Google to get sent to the German website.

Use locale-specific URLs.

Google emphasizes the importance of using separate pages containing geo-specific content, rather than a single site dynamically displaying location-based content. This way, it can crawl and index the pages individually and rank them in the search results.

Therefore, consider using locale-specific URLs for your website. This makes it easier to geotarget your site to different regions.

There are different ways to structure your URLs. A country-specific domain (awesome.de) will help you separate your sites easily and allows clear geotargeting, but it can be expensive and requires more infrastructure while only targeting a single country.

Another way is using subdomains with a generic top-level domain (gTLD) like de.awesome.com, which is easy to set up, as well as subdirectories with gTLD (awesome.com/de), which is low-maintenance. Google recommends using separate URLs to maximize indexing and achieve a better ranking for all content variations.

Use rel="alternate" hreflang annotations.

Google not only strongly emphasizes the use of separate locale-specific URL configurations, but it also encourages annotating them with rel= "alternate" hreflang tags. These tags tell Google about the variations of your content so that Google knows that you work with localized variations of the same content.

Use a reverse DNS lookup.

You can use a location-based reverse domain name system (DNS) lookup to check the crawling operations of the Googlebot. A reverse DNS lookup is a query for the domain name associated with a particular IP address.

You can do this either manually for one-off lookups or automatically for large-scale lookups. If manually is sufficient for your needs, you can check out Google's command line tools. If you want to check multiple crawler IP addresses, an IP API can help you match them against the published list of Googlebot IP addresses.

Follow the robots exclusion protocol.

Furthermore, Google encourages you to ensure that all your sites consistently adhere to the robots exclusion protocol. All robots meta tags and the robots.txt file in each locale must therefore contain the same directives.

Inform Google about your alternate pages.

Don't leave it to chance for Google to find your geo-specific sites. There are three ways you can inform Google about different versions of your page: HTML, HTTP Headers, and Sitemaps. Google has exact guidelines for all methods on how to do so. Here are the key takeaways:

  • Your alternate pages do not have to be the same domain, but they must be fully qualified (https://awesome.com/de, or http://de.awesome.com).
  • Each version of your site must list itself and every other country's version. Google will ignore the tags if two sites don't point to one another.
  • Managing and maintaining directional links for all your geo-specific sites can be challenging. This is why Google suggests omitting some pages so they can still process the ones that link to each other.
  • Always link new pages to your original site. For example, it's more important to bidirectionally link awesome.de to your main page (awesome.com) than to another, newer geo-specific site like awesome.es.

Common Geo Redirection Mistakes

I know, this is a lot of information! Geo IP redirects are powerful but leave room for consequent mistakes. Since we obviously don’t want your website to suffer, here are some of the most common mistakes and how to avoid them.

You used a 301 Redirect.

A 301 is a permanent redirect, and a 302 is meant to be a temporary redirect. It might therefore seem logical to use a permanent redirect. However, the source page will continue to exist, and you want it to keep ranking.

How to avoid: Google recommends using a 302 redirect instead of a permanent 301 for location-specific redirection.

If you use a 301, you tell Google that your source page doesn’t exist anymore, which is why you permanently link it to another page. However, you still want Google to know your main site still exists and for your intended user group to find it.

For your source page to keep ranking, it needs to be accessible from the intended geographic location. If Google isn’t sure whether or not your page still exists, your page performance will suffer.

You didn’t allow Googlebot access.

You blocked crawlers or forgot to treat them like your users, so Google didn’t index those pages or approve ads.

How to avoid: This issue is likely to be discovered quickly, as your organic traffic might suffer, and Goole will reject your ads. It’s important to allow your users and Googlebot to access your entire site. The easiest way is by offering an easy-to-find language or country navigation.

You also redirected internal site traffic based on IP.

Some users simply travel and want to use the version associated with their home country. Once on the site, they should be able to navigate freely.

How to avoid: Traffic that goes through your country navigation should not be geo-based redirections. Ideally, it should bring the user or crawler to the same site only for a different country or language.

Make sure the navigation to switch to a different country is easy to find. Many websites put a globe or flag icon in the header of their website to visually indicate the target region of the page.

How to Implement IP-based Geo Redirection in WordPress

As we’ve learned, geo-specific redirection is no walk in the park. But there is an easy and smooth way to implement it into WordPress. All you need is an IP Plugin. Here is a step-by-step on how to implement a location-based redirection.

First, install and activate the IP2Location on your website.

the ip2location redirection plugin download page

Image Source

Next, click on the new IP redirection tab in the WordPress dashboard menu. A pop-up will appear. Click "Get Started" and follow the steps through the onboarding process. You'll need to create a free account with IP2location to download the necessary IP data.

For the last step, you now need to configure your redirection rules manually.

For this, enter the countries you want to redirect under "Location." I used France in my example below. "From" is where you put the source site that you want them to steer away from. You can choose a site from the drop-down menu or enter a specific URL, as I did in my example below.

Now, we need to define the destination page our visitors from France will get redirected to instead, and of course, we have to determine the "Status" of the page, which should be a 302 temporary redirect. We set it to active and make sure not to check the last box saying "do not redirect bots and crawlers, as we want to treat them like our visitors.

the ip2location redirection plugin settings pge

And that's it! Using a WordPress plugin is the easiest way to implement IP-based redirection. If you want to dive further into this topic, you can check out this great article about setting up a WordPress redirect.

If you have a team of developers at hand, using an IP API is another excellent way to redirect your users. While this needs some programming know-how, it can be more tailored to your specific needs.

Alternative to Automatic IP-based Geo Redirection

While IP redirection has a lot to offer, there are downsides as we have discussed. If you don't have the time or resources to implement it, one alternative to automatic redirection is letting your users choose the country-specific site they want to visit. This also ensures that Googlebot can reach your sites without any issues.

Even though it needs the user to take an extra step, it still offers a good user experience. For example, the global fashion company H&M uses this method.

the H&M region navigation pageImage Source

IP Redirection: A Powerful Tool

IP-based geo-redirection can help your users find more relevant content and have a great user experience. However, it's important to follow Google's guidelines to profit from improved SEO and user experience.

Make sure your country-specific sites are clearly structured and linked to each other, so Google can easily find them. And remember to use a 302 redirect instead of a 301, and to treat crawlers like users.

WordPress plugins are the easiest way to implement IP-based geo-redirection into your website. However, if you are not looking to automate your location-based redirection, you can let your users choose their county before entering your site.

Either way, targeting users on their location gives your website a more personal touch. It can boost their trust in your service or product, which boosts your conversion rate.

coding-hacks

 

Related Articles

We're committed to your privacy. HubSpot uses the information you provide to us to contact you about our relevant content, products, and services. You may unsubscribe from these communications at any time. For more information, check out our Privacy Policy.

Tangible tips and coding templates from experts to help you code better and faster.

CMS Hub is flexible for marketers, powerful for developers, and gives customers a personalized, secure experience

START FREE OR GET A DEMO