我已经在github页面上实现了重定向,但由于某种原因,您的服务器正在为重定向页面返回"application/octet stream"的内容类型。这导致浏览器无法呈现重定向页面,因此生成的javascript无法实际执行重定向。
如何使响应标头指定text/html作为内容类型,以便重定向工作?
这是网址。
http://www.pknopf.com/blog/performance-ccli-vs-com
以下是回应。
HTTP/1.1 200 OK
Server: GitHub.com
Content-Type: application/octet-stream
Last-Modified: Sat, 06 Sep 2014 04:30:37 GMT
Expires: Sat, 06 Sep 2014 04:41:33 GMT
Cache-Control: max-age=600
Content-Length: 598
Accept-Ranges: bytes
Date: Sat, 06 Sep 2014 04:40:38 GMT
Via: 1.1 varnish
Age: 545
Connection: keep-alive
X-Served-By: cache-iad2132-IAD
X-Cache: MISS
X-Cache-Hits: 0
X-Timer: S1409978438.779912,VS0,VE2
Vary: Accept-Encoding
<!DOCTYPE html>
<meta charset=utf-8>
<title>Redirecting...</title>
<link rel=canonical href="http://www.pknopf.com/development/2013/03/07/Performance-CPP-CLI-vs-COM.html">
<meta http-equiv=refresh content="0; url=http://www.pknopf.com/development/2013/03/07/Performance-CPP-CLI-vs-COM.html">
<h1>Redirecting...</h1>
<a href="http://www.pknopf.com/development/2013/03/07/Performance-CPP-CLI-vs-COM.html">Click here if you are not redirected.</a>
<script>location='http://www.pknopf.com/development/2013/03/07/Performance-CPP-CLI-vs-COM.html'</script>
如文档中的jekyll重定向所示,重定向URL需要一个尾部斜杠。
在你的帖子中,你必须在重定向中添加一个斜杠。
例如:_posts/2013-03-07-Performance-CPP-CLI-vs-COM.md
redirect_from: "/blog/performance-ccli-vs-com"
变为:
redirect_from: "/blog/performance-ccli-vs-com/"