Redirects within netlify.toml not working?

Hey all, I have been having trouble getting redirects to work when defined in the netlify.toml file, but they seem to work when defined in a _redirects file instead. Here’s a link to the toml file I tried in the past:

I instead had to replace it with:

I was following Kent C. Dodds’ tutorial for the URL shortener and forked his project which contains a netlify.toml that seems to work for him and I assume others since I haven’t seen any mention of problems. Here is his toml file that I forked:

It works for him in his tutorial but not when I do it.

Is there a setting somewhere to properly enable redirects when creating a project? Here is the site that I’m following the tutorial with:

1 Like


ct-short-link doesn’t appear to be a valid netlify site, did you rename or delete it? If so, please provide a link to one of your deploy logs with the netlify.toml in it so we can take a look. Thanks.

Yes, I had deleted it but I have remade it again with the same fork of the project. Here is the link to the Github repo:

The site name I have remade it to be ct-short-link again.

According to the last redirect rule, /magic should be redirected to the function route, but it doesn’t seem to work. It does function correctly when I navigate directly to the function endpoint like /.netlify/functions/redirect/magic (which is supposed to redirect to YouTube).

Hi @chris-tse,

The repo you forked that’s linked to that site doesn’t have your redirect rules that you mentioned in it. Can you give me a URL that’s not redirecting like you are expecting it to? Thanks.

1 Like

as @chris-tse mentioned, it seems that the redirects on the netlify.toml file does not work. with the _redirects file woks perfect.

here’s my github fork where I fix the issue:

hope this helps!

Those redirects should be working from the netlify.toml. But I’d need to see a site that has them deployed to dig in to it further. Let me know if anyone has a link. Otherwise I’m glad you found a workaround @horacio