为什么netlify重定向“/索引”到“/&quot”当“ index.html”时存在(没有定义的自定义规则)
我们托管我们的网站Netlify。我们没有设定的重定向规则。
访问以“索引”结尾的URL(例如“ Animal.com/cats/index”)(假设那里有真正的index.html页面)netlify将进行301重定向,检索index.html,并设置URL到根“ andime.com/cats/”。
此行为也可以在Netlify文档中看到 打开“ https://docs.netlify.com/routing/headers/index” - >将重定向到“ https://docs.netlify.com/routing/headers/”。
这种行为在哪里指定?我在他们的文档中找不到任何东西。
We host our website with Netlify. We have no redirect rules set on our side.
When accessing a url which ends in "index" (for example "animals.com/cats/index") (assuming there is the real index.html page there) Netlify will do a 301 redirect, retrieve index.html, and set the url to the root "animals.com/cats/".
This behaviour is also possible to see in Netlify docs
Open "https://docs.netlify.com/routing/headers/index" -> in will redirect to "https://docs.netlify.com/routing/headers/".
Where is this behaviour specified? I can't find anything in their docs.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我联系了Netlify支持,他们解释了它的工作原理。
“资产优化”中有一个选项,即设置“启用”允许启用“漂亮URL”的选项。
使用漂亮的URL会自动发生重定向。
I contacted Netlify support and they explained how it works.
There is an option in "Asset optimization" which is when set to "Enable" allows to enable "Pretty URLs".
With pretty urls there is redirection happening automatically.