jekyll - GitHub 页面尾部斜杠

标签 jekyll github-pages middleman

通过 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/

相关文章:

middleman - 如何仅在生产版本上渲染部分内容?

ruby - 在 Middleman 中移动博客文章位置

javascript - Bootstrap JS 不与中间人一起工作

html - 无法访问自定义 Front Matter 变量

jekyll - 为 GitHub Pages 自定义 Jekyll 远程主题

javascript - 我如何用更少的 Javascript 行来表达这一点?

git - 如何使用 index.html 作为子目录的符号链接(symbolic link)在 gh-pages 中部署

html - 为什么 Jekyll 加载 navbar.less?

github-pages - Github 页面构建失败

ruby - 为什么在安装 gem 时出现 "permission denied"错误?