[英]GitHub Pages trailing slashes
Using Middleman on GitHub Pages with directory_indexes enabled, I wonder if I can somehow get rid of the trailing slash GitHub adds. 在启用了directory_indexes的 GitHub Pages上使用Middleman,我想知道是否可以摆脱GitHub添加的结尾斜杠。
My urls are basically: /foo-bar -> /foo-bar/index.html
. 我的网址基本上是:
/foo-bar -> /foo-bar/index.html
。
Visiting /foo-bar
on GitHub Pages redirects to /foo-bar/
. 访问
/foo-bar
在GitHub上的页面重定向到/foo-bar/
。
Is there any way to prevent this redirect? 有什么办法可以防止这种重定向?
A "trailing slash" redirect is issued when the server receives a request for a URL http://servername/foo/dirname where dirname is a directory.
当服务器收到URL http:// servername / foo / dirname的请求时,将发出“尾随斜杠”重定向,其中dirname是目录。 Directories require a trailing slash, so mod_dir issues a redirect to http://servername/foo/dirname/ .
目录要求末尾加斜杠,因此mod_dir发出重定向到http:// servername / foo / dirname /的命令 。
The problem with this is that GitHub pages / Jekyll build the way you have shown above. 问题在于,GitHub页面/ Jekyll构建您上面显示的方式。 To fix this,
foo-bar
needs to be a file rather than a directory: 要解决此问题,
foo-bar
必须是文件而不是目录:
http://example.com/foo-bar.html
Then you should be able to do: 然后,您应该可以执行以下操作:
http://example.com/foo-bar
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.