为什么netlify重定向“/索引”到“/&quot”当“ index.html”时存在(没有定义的自定义规则)

发布于 2025-02-09 08:55:57 字数 337 浏览 1 评论 0原文

我们托管我们的网站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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦里寻她 2025-02-16 08:55:57

我联系了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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文