Netlify redirects

How do you guys manage redirects in Netlify? I was reading the article but just didn't stick to me. https://docs.netlify.com/routing/redirects/ I made a file like it says in here (a _redirects file), but nothing really changed :(
Redirects and rewrites
Manage traffic to your site by defining redirect or rewrite rules in a _redirects file or a netlify.toml file.
44 Replies
b1mind
b1mindā€¢3y ago
is it in the root of your publish dir?
Myndi
MyndiOPā€¢3y ago
That's what I'm wondering as well. Should be sitting next to something like robots.txt? Or in my public? In this case I'm using Astro.
b1mind
b1mindā€¢3y ago
base build folder (if that is public then yes) I have not used Astro recently I remember it building to Public though so probably
Myndi
MyndiOPā€¢3y ago
Now that I'm seeing it, Astro didn't pick it up from src. So I guess it should be in public.
b1mind
b1mindā€¢3y ago
yea so its not getting included in the build step
Myndi
MyndiOPā€¢3y ago
Let me try then.
b1mind
b1mindā€¢3y ago
yea can also tell Vite to include it.
Myndi
MyndiOPā€¢3y ago
Astro uses Vite, right (to confirm)? (as builder)
b1mind
b1mindā€¢3y ago
yes Astro is essentially just a Vite plugin without it we would have no Astro šŸ˜„ (well not true Fred started it with his bundler Snowpack... which is lots like Vite) SvelteKit is as well, they actually removed the abstraction and ARE a plugin for Vite. This really makes it nice imo to configure things.
Myndi
MyndiOPā€¢3y ago
How can I check if Netlify has access to it?
Myndi
MyndiOPā€¢3y ago
Wind Cutter Guide
Comprehensive, concise and dynamic Ragnarok Online guide.
Myndi
MyndiOPā€¢3y ago
Is there any way by looking at the dev tools?
b1mind
b1mindā€¢3y ago
na cause its an internally used file shouldnt be served to the client. I'm still rather unexperienced in Netlify lemmi look at mine
Myndi
MyndiOPā€¢3y ago
They mention a netlify.toml but I don't understand how to configure it. It's under functions.
b1mind
b1mindā€¢3y ago
Yea that is another way but I think you would have the same issue cause it needs to be in the root šŸ¤” oh no you can set its dir in admin
Myndi
MyndiOPā€¢3y ago
Myndi
MyndiOPā€¢3y ago
This is the root, right?
b1mind
b1mindā€¢3y ago
Yes that is root
Myndi
MyndiOPā€¢3y ago
This is after I ran npm run build.
b1mind
b1mindā€¢3y ago
yea should be the right spot, ship it
Myndi
MyndiOPā€¢3y ago
Yeah I did, that's the live sadCat me try something.
Myndi
MyndiOPā€¢3y ago
This is the one I want it to redirect. https://cozynova.online/hackandslasher/
Wind Cutter Guide
Comprehensive, concise and dynamic Ragnarok Online guide.
Myndi
MyndiOPā€¢3y ago
Myndi
MyndiOPā€¢3y ago
And this is what I have in the file. Unless I need to specify... even further?
b1mind
b1mindā€¢3y ago
Can I ask why the redirect?
Myndi
MyndiOPā€¢3y ago
I need to change the name of it. As the guide was used in the community, some people will know it as /windcutter instead. So I don't want to leave them with a 404 šŸ˜­
b1mind
b1mindā€¢3y ago
ok its perfect case for 302 redirect just checking oh sry 301 (is perm) >.>;;
Myndi
MyndiOPā€¢3y ago
Yeah šŸ˜­ Don't worry I did some research before asking. I just couldn't get it to work as I wanted.
b1mind
b1mindā€¢3y ago
Yea so looks like you would want the TOML probably cause that lets you set the response code too
b1mind
b1mindā€¢3y ago
Stack Overflow
How to make 301 redirect in Netlify work?
I can't get the 301 redirect to work in Netlify at all (I've seen other answers, but it doesn't work). I've made the _redirects file and placed it in the root of my github ripo. https://zen-booth-...
Myndi
MyndiOPā€¢3y ago
So kind of the same logic as _redirects.
b1mind
b1mindā€¢3y ago
They were putting the _redirect in the project root šŸ¤”. Either way looks like proper way would be the TOML
Myndi
MyndiOPā€¢3y ago
From what I'm understanding.
b1mind
b1mindā€¢3y ago
yea
[[redirects]]
from = "https://cozynova.online/windcutter"
to = "https://cozynova.online/hackandslasher"
status = 301
force = true
[[redirects]]
from = "https://cozynova.online/windcutter"
to = "https://cozynova.online/hackandslasher"
status = 301
force = true
oh I noticed you linked with a trailing slash are you linking them with trailing slash??
Myndi
MyndiOPā€¢3y ago
I was following the page's example:
Myndi
MyndiOPā€¢3y ago
It looked simple enough.
b1mind
b1mindā€¢3y ago
that is the _redirect file though. I would try the toml simple cause it lets you define the status code
Myndi
MyndiOPā€¢3y ago
Yeh, I will use .toml now, or rather, try.
Myndi
MyndiOPā€¢3y ago
Wind Cutter Guide
Comprehensive, concise and dynamic Ragnarok Online guide.
Myndi
MyndiOPā€¢3y ago
Mind trying it to see if it works?
b1mind
b1mindā€¢3y ago
works šŸŽ‰
Myndi
MyndiOPā€¢3y ago
Great, thanks! Case closed šŸ¤
b1mind
b1mindā€¢3y ago
welcome
Want results from more Discord servers?
Add your server