域名绑定到 Github Pages 后怎么做 301 跳转
大概是要从 /index.php/post-xxx.html
跳转到 /post-xxx.html
,Jekyll 可以 301 吗
——刚想问就看到了这个:https://github.com/jekyll/jekyll-redirect-from,不过还是水一贴 (ಡωಡ)
首先:
gem install jekyll-redirect-from
然后在 _config.yml
添加:
plugins:
- jekyll-redirect-from
在文章可以:
redirect_from: /index.php/post-xxx.html
不过是在 /_site/index.php/post-xxx.html
下这样跳转的:
<!DOCTYPE html>
<html lang="en-US">
<meta charset="utf-8">
<title>Redirecting…</title>
<link rel="canonical" href="http://localhost:4000/post-xxx.html">
<script>location="http://localhost:4000/post-xxx.html"</script>
<meta http-equiv="refresh" content="0; url=http://localhost:4000/post-xxx.html">
<meta name="robots" content="noindex">
<h1>Redirecting…</h1>
<a href="http://localhost:4000/post-xxx.html">Click here if you are not redirected.</a>
</html>