我阅读了 GitHub 页面 documentation用于使用 jekyll-redirect-from 插件在 GitHub Pages 上启用重定向。我能够从一个页面重定向到另一页面,但我有一些不同的要求。我需要将所有页面从一个起始网址重定向到另一个。
这些网址
www.example.com/abc/def
www.example.com/abc/xyz
应该重定向到
www.example.com
最佳答案
如stated in the documentation for the plugin ,您可以为 redirect_from
键添加指定多个 url。
例如,创建一个 index.md
文件:
---
title: index
redirect_from:
- /abc/def/
- /abc/xyz/
---
## Hello, world!
和一个_config.yml
,其中:
title: Redirection test
markdown: kramdown
plugins:
- jekyll-feed
- jekyll-redirect-from
现在 /abc/def
和 /abc/xyz
都将重定向到您的索引页面。
关于重定向 GitHub Pages 上的多个网页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60666679/