Netlify Redirect not working

夙愿已清 提交于 2021-01-27 07:20:24

问题


so yesterday I was having a problem because I wasn't able to implement a 301 redirect to my page hosted on the GitHub pages.

Today I found Netlify which should be able to do 301 redirects. However something is not working, the docs say I need to add the redirect in a _redirect file, but nothings working. Any ideas what I am doing wrong?

Here is the Test page: https://peaceful-swanson-2960b1.netlify.com/

(It should redirect to news when you click on blog)

Here is the GitHub Repo:

https://github.com/vnllab/testy


回答1:


2 things:

  • you mention the _redirect file. It should be _redirects.

  • I had an issue with a redirect. It took me a while to figure out that if I put a catch-all rule first, the other rules would never be reached (well at least that's what I think was happening, my other rule was ignored...).

This:

/* /index.html 200
http://mysite.netlify.com/* https://mysite.netlify.com/:splat 301!

didn't work, but this:

http://mysite.netlify.com/* https://mysite.netlify.com/:splat 301!
/* /index.html 200

works fine...



来源:https://stackoverflow.com/questions/50201224/netlify-redirect-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!