Hello!
I just added my site on Netlify, and everything seems to work well, except for one thing.
I’ve read a bunch of similar topics but didn’t help.
I have a very simple static website created with Bootstrap - https://www.radu.link. No site generators, build commands; nothing.
My files aren’t in a public
, src
, or similar folders. The index.html
file is directly in the root, along with the netlify.toml
file.
The issue
Currently, the homepage is also accessible via /index.html
, creating a duplicate. Even if I have a canonical URL set, I prefer redirecting it to the root /
.
So, I added this to the netlify.toml
file:
[[redirects]]
from = "/index.html"
to = "/"
status = 301
force = false
But it doesn’t work.
I also tried:
-
_redirects
file; - adding
force = true
; - adding the full home URL in
to
.
I have other things in the file that work fine:
[[redirects]]
from = "https://compassionate-borg-d88757.netlify.app/*"
to = "https://www.radu.link/:splat"
status = 301
force = true
[[headers]]
for = "/*"
[headers.values]
X-Frame-Options = "DENY"
X-XSS-Protection = "1; mode=block"
So, the placement of the file is not an issue. Either I’m adding the redirection code wrong, or it’s not possible to perform that type of redirect.
Any help would be appreciated!
Thanks!