<lp>

Gatsby + Netlify Redirects = Easy

Published:

Redirects are essential to web development, especially when renaming pages… Next time you find yourself updating a URL on a Gatsby site, Netlify has your back. gatsby-plugin-netlify to be specific. createRedirect seems like a nifty tool to use in your gatsby-node.js file, but in the time crunch I found myself in; it didn’t work.

Enter /static/_redirects

This was simple, easy, and worked without a single issue. You just add redirects like so:

# Manual Redirects
/home   /
/contact    /contact-us

If you want to get fancy, you can use the Netlify playground to test redirect rules. Simple, quick, and convenient. Let me know if you find issues or have other thoughts on easier ways to implement redirects.

What if I’m not on Netlify?

The Actions page on Gatsby.org outlines a few more options for S3 and simple static hosts. I suggest you dig into those, here!