Reputation: 471
I am new to Netlify config things, so any help is appreciated. I am setting up a vanilla html, css, and javascript site through Netlify and I want to make it so if I link to https://example.com/about
then they are served the about.html
page. Can I do something similar to this in my netlify.toml
file?
If I don't include the from = "/*"
then I can't access the site, but I am wanting to route from /reset-password
to the page reset-password.html
Again, any help is appreciated!
from = "/*"
to = "/index.html"
status = 200
from = "/reset-password"
to = "/reset-password.html"
status = 200
Upvotes: 2
Views: 1485
Reputation: 171
Technically, Slakinov's is wrong.
it will always use the first match it finds when processing redirect rules and ignore any subsequent matches.
So
[[redirects]]
from = "/reset-password"
to = "/reset-password.html"
status = 200
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
Upvotes: 3
Reputation: 341
Add a [[redirects]] header for each redirect rule:
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
[[redirects]]
from = "/reset-password"
to = "/reset-password.html"
status = 200
Upvotes: 3
Reputation: 471
As I studied the rest of the day, I found out that any .html
files will exist as routes and so there is no need for redirects. if you want to link to example.com/about
you just create an about.html
page and it will automatically be served at that endpoint.
Upvotes: 0