---
title: "How to Localize a Website with Netlify Redirects & Rewrites"
description: "Visiting Netlify"
source: "https://www.netlify.com/blog/2020/10/30/easy-localization-with-netlify-redirects-and-rewrites/"
last_updated: "2026-07-10T17:19:39.000Z"
---
If you visited our homepage recently and are in the United States, you might have noticed that we added a small dismissible US Election banner at the top of the page to encourage Americans to make their voice heard and go vote in the upcoming election.

![Screenshot of Netlify's US homepage with Election banner](/v3/img/blog/go-vote.jpg)

One of our goals was to keep that banner relevant for US visitors only and we were able to easily achieve that with our own [redirects and rewrites](https://docs.netlify.com/routing/redirects/) engine.

## Preparing the site

Since we use a [combination of Eleventy and Vue](https://www.netlify.com/blog/2020/09/18/eleventy-and-vue-a-match-made-to-power-netlify.com/), we were able to quickly spin up a custom US version of our homepage using Vue’s components and props, but any stack will work as the requirements are only two different HTML files. Our code looks a bit like this:

index.vue

```
<template>  <home></home></template>
```

index-us.vue

```
<template>  <home country=“us”></home></template>
```

components/home.vue

```
<template>  <div>    <header />    <div v-if=“country === ‘us’”>      <election-banner />    </div>    …  </div></template>
```

This will output an `index-us.html` with our Election banner while keeping our original `index.html` unchanged.

## Country-based redirects

With Netlify Redirects, we can show site visitors different content based on their location by adding a `Country` condition to our `_redirects` file:

```
/   /index-us.html  200!  Country=us
```

Now, whenever someone visits Netlify and is located in the United States, they will get served the content from `index-us.html` instead of the regular `index.html`. We assign a [200 status code](https://docs.netlify.com/routing/redirects/redirect-options/#http-status-codes) to keep the visitor’s URL the same, while Netlify’s servers fetch the new page behind the scenes.

If you have more complex use cases, there are [great examples in the docs](https://docs.netlify.com/routing/redirects/redirect-options/#redirect-by-country-or-language) on how to handle whole domain redirect or redirect by language instead of country.

## A word on web performance

Unlike a typical client-side JavaScript solution, redirecting at the edge opens up tons of localization customization while keeping our page performance and [web vitals](https://web.dev/vitals/) intact, especially reducing our [Cumulative Layout Shift (CLS)](https://web.dev/cls/), resulting in a better user experience.

In the future, we want to keep showing more pertinent information to our visitors. Customer’s case studies or quotes based on our visitor’s location or language are a couple examples that become a breeze to put in place with our redirects and rewrites.

### Share

-   [X (fka Twitter)](https://twitter.com/intent/tweet?text=Easy localization with Netlify redirects and rewrites&url=https://www.netlify.com/blog/2020/10/30/easy-localization-with-netlify-redirects-and-rewrites//)
-   [LinkedIn](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.netlify.com%2Fblog%2F2020%2F10%2F30%2Feasy-localization-with-netlify-redirects-and-rewrites%2F%2F)
-   [Facebook](https://www.facebook.com/sharer.php?u=https://www.netlify.com/blog/2020/10/30/easy-localization-with-netlify-redirects-and-rewrites//)
-   [Bluesky](https://bsky.app/intent/compose?text=Easy localization with Netlify redirects and rewrites+https://www.netlify.com/blog/2020/10/30/easy-localization-with-netlify-redirects-and-rewrites//)

* * *

### Tags

-   [Redirects](/blog/tags/redirects/)

## Keep reading

![](/images/blog-fallback-thumbnail.svg)

Guides & Tutorials May 4, 2017

[

### How to do redirects on Netlify

](/blog/2017/05/04/how-to-do-redirects-on-netlify/)

-   ![Profile picture of Brian Douglas](/_astro/7e4e2489f26643cddb033734c3767988b368f1e4-400x400_WQt0U.webp)
    
    Brian Douglas
    

![](/_astro/3f45eb6eda4ea8814be310e3df4a7883a5bd9ba0-1200x675_ZcBDUS.webp)

Guides & Tutorials May 15, 2026

[

### How to build a real-time AI chatbot in minutes with Netlify Agent Runners (no backend)

](/blog/how-to-build-a-real-time-ai-chatbot-in-minutes-with-netlify-agent-runners-no-backend)

-   ![Profile picture of Nahrin Jalal](/_astro/f0e7c8f227a03fe58340c99ef5439d5a896c0733-272x272_Z23kDpD.webp)
    
    Nahrin Jalal
    

## Recent posts

News & Announcements June 25, 2026

[

### Netlify Functions, designed for Agent Experience

](/blog/netlify-functions-designed-for-agent-experience)

-   ![Profile picture of Eduardo Bouças](/_astro/52958f21e8450baf6d8e60302341a984e220c0cd-512x512_13VDlu.webp)
    
    Eduardo Bouças
    

News & Announcements June 24, 2026

[

### How we measure Netlify’s Agent Experience

](/blog/how-we-measure-netlify-agent-experience)

-   ![Profile picture of Sean Roberts](/_astro/bbf2243f8171dbddd80ab2103622106cef84d125-512x512_Z1d2LKE.webp)
    
    Sean Roberts
    

Guides & Tutorials May 15, 2026

[

### How to build a real-time AI chatbot in minutes with Netlify Agent Runners (no backend)

](/blog/how-to-build-a-real-time-ai-chatbot-in-minutes-with-netlify-agent-runners-no-backend)

-   ![Profile picture of Nahrin Jalal](/_astro/f0e7c8f227a03fe58340c99ef5439d5a896c0733-272x272_Z23kDpD.webp)
    
    Nahrin Jalal
    

![](/_astro/3f255b372fa958df35802666ee33b4609b2d71bd-1200x1586_1VtE2D.webp)

### How do the best dev and marketing teams work together?

[Access the report](https://www.netlify.com/reports/2024-leadership-trend-report/access/)