---
title: "Setting up redirects on Netlify"
description: "Learn how to configure redirects and rewrites for your Netlify sites."
source: "https://www.netlify.com/blog/2021/12/13/setting-up-redirects-on-netlify/"
last_updated: "2026-07-10T20:45:27.000Z"
---
> Throughout December we’ll be [highlighting a different Netlify feature each day](https://www.netlify.com/blog/2021/12/01/highlighting-a-different-netlify-feature-each-day-in-december/). It might just be the thing you need to unlock those creative juices, and [dust off that domain](https://www.netlify.com/blog/2021/12/01/dusty-domains-your-forgotten-domains-raise-money-for-charity/?utm_campaign=devex-ph&utm_source=netlify&utm_medium=blog&utm_content=adventure-cli-dev) you registered but never deployed! Keep an eye [on the blog](https://www.netlify.com/blog/2021/12/01/highlighting-a-different-netlify-feature-each-day-in-december/?utm_campaign=devex-ph&utm_source=netlify&utm_medium=blog&utm_content=adventure-cli-dev) and on [Twitter](https://twitter.com/netlify) for each feature!

If you’ve used Netlify Functions before, you may know that one way to trigger them is to visit your site with the path `/.netlify/functions/<your function name>`. However, if you wanted to expose your functions as an API, this doesn’t look super user-friendly. Instead, we can use redirects to improve it!

We’ve made setting up redirects in your app easier so you can get started quickly. Let’s have a look!

First, you need to create a `_redirects` file in the publish directory of your site.

In this file, we can define our redirects with the following syntax:

```
/api/* /.netlify/functions/:splat 200
```

In the code sample above, the asterisk (`*`) is used to indicate anything that follows `/api/` will be matched to anything that follows `/.netlify/functions/`. For example, if you are selling products and want to have an API endpoint available such as `/api/products`, it will be matched to your functions `products.js` available at `/.netlify/functions/products`.

Additionally, you can add other options like a HTTP status code, query parameters, redirect by country or language, and more!

For example, if you wanted to redirect to `/produits` instead of `/products` for people in France, you would specify it this way:

```
/api/produits /.netlify/functions/products 302 Country=fr
```

For more details about the different options available and how to use them, check out [our docs](https://docs.netlify.com/routing/redirects/redirect-options/).

Another way to set up redirects in your app is via the `netlify.toml` file.

If we take the same example as the one above, the syntax in the `netlify.toml` file would be:

```
[[redirects]]  from = "/api/*"  to = "/.netlify/functions/:splat"  status = 200
```

As with the `_redirects` file, you can use additional options if you need to pass headers, conditions, query parameters, and more, for more complex applications.

Check out [our docs](https://docs.netlify.com/routing/redirects/) for more information about redirects and rewrites!

### Share

-   [X (fka Twitter)](https://twitter.com/intent/tweet?text=Setting up redirects on Netlify&url=https://www.netlify.com/blog/2021/12/13/setting-up-redirects-on-netlify//)
-   [LinkedIn](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.netlify.com%2Fblog%2F2021%2F12%2F13%2Fsetting-up-redirects-on-netlify%2F%2F)
-   [Facebook](https://www.facebook.com/sharer.php?u=https://www.netlify.com/blog/2021/12/13/setting-up-redirects-on-netlify//)
-   [Bluesky](https://bsky.app/intent/compose?text=Setting up redirects on Netlify+https://www.netlify.com/blog/2021/12/13/setting-up-redirects-on-netlify//)

* * *

### Tags

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

## Keep reading

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

Guides & Tutorials November 5, 2021

[

### How to Internationalize Sites with Country-Based Redirects

](/blog/2021/11/05/how-to-internationalize-sites-with-country-based-redirects)

-   ![Profile picture of Bhavana Srinivas](/_astro/9f4bce1c7876ac67c51d82bf5794acb3d01c77db-328x328_2jibP6.webp)
    
    Bhavana Srinivas
    

![](/_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/)