Hello! I can’t seem to figure out the right way to get redirects to work on my help center. The below examples are just tests, ideally I’d like to redirect a subfolder to a new subfolder.
- I’ve tried storing them in
_redirects
,_redirects.txt
, andnetlify.toml
. - I’ve tried using the following build commands:
hugo && cp _redirects /_redirects
hugo && cp _redirects public/_redirects
- I’ve tried with and without
301
and301!
- I’ve tried using full URLs
_redirects examples
Note: no matter how many redirects i put in the _redirects
file, the log says 1 redirect rule successfully processed.
/mytest2 /developers 301!
/news /blog 301
https://deploy-preview-129--bolt-docs.netlify.app/mytest2 https://deploy-preview-129--bolt-docs.netlify.app/developers
https://deploy-preview-129--bolt-docs.netlify.app/mytest3 https://deploy-preview-129--bolt-docs.netlify.app/shoppers 301
https://deploy-preview-129--bolt-docs.netlify.app/mytest4 https://deploy-preview-129--bolt-docs.netlify.app/merchants 301!
netlify.toml examples
Note: the log says 3 redirect rules succesfully processed.
[redirects]]
from = "/old-path"
to = "/new-path"
status = 301
force = false
[[redirects]]
from = "/releases"
to = "/shoppers"
status = 301
force = true
General Questions
- does this kind of testing work in deploy previews?
- for
_redirects
, does the number of spaces or tabs inbetween matter? - does it take a certain amount of time to work and i need to wait to validate?