通过 directory_indexes 在 GitHub Pages 上使用 Middleman启用,我想知道我是否可以以某种方式摆脱 GitHub 添加的尾部斜杠。
我的网址基本上是:/foo-bar -> /foo-bar/index.html
.
来访 /foo-bar
在 GitHub 页面上重定向到 /foo-bar/
.
有什么办法可以防止这种重定向?
最佳答案
A "trailing slash" redirect is issued when the server receives a request for a URL http://servername/foo/dirname where dirname is a directory. Directories require a trailing slash, so mod_dir issues a redirect to http://servername/foo/dirname/.
Source
问题在于 GitHub 页面/Jekyll 以您显示的方式构建
以上。要解决此问题,
foo-bar
需要是文件而不是目录:http://example.com/foo-bar.html
那么你应该能够做到:
http://example.com/foo-bar
§ Permalinks
关于jekyll - GitHub 页面尾部斜杠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33270605/