使用-L flash,curl应该遵循重定向,但我有301永久移动。
例如:curl -I -L -s era-min-eu.org |头-n 1
响应:HTTP / 1.1 301永久移动
你能帮帮我吗?
由于
答案 0 :(得分:1)
您正在查看输出,只显示示例代码中的第一行。无头运行该命令会显示其余响应:
$ curl -I -L -s era-min-eu.org
HTTP/1.1 301 Moved Permanently
Server: nginx/1.10.3
Date: Wed, 28 Feb 2018 15:44:35 GMT
Content-Type: text/html
Connection: close
Location: http://era-min.prod.lamp.cnrs.fr
Cache-Control: max-age=10800
HTTP/1.1 503 Service Temporarily Unavailable
Date: Wed, 28 Feb 2018 15:44:36 GMT
Server: Apache
P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
Expires: Wed, 17 Aug 2005 00:00:00 GMT
Last-Modified: Wed, 28 Feb 2018 15:44:36 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
X-Frame-Options: SAMEORIGIN
Content-Type: text/html; charset=utf-8
Set-Cookie: ee178549c4135355897a0fd336ea26d8=0jabfedtnk08u4ru0u29uq9a86; path=/; HttpOnly
Connection: close
答案 1 :(得分:0)
正如@zzevann上面解释的那样,重定向确实有效。初始网站提供301错误,但低于它转发并显示Location: http://era-min.prod.lamp.cnrs.fr
行中指示的更新网站的卷曲信息。
在更新的网址上运行curl:
$ curl -I -L -s era-min.prod.lamp.cnrs.fr
输出:
HTTP/1.1 503 Service Temporarily Unavailable
Date: Wed, 28 Feb 2018 16:27:28 GMT
Server: Apache
P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
Expires: Wed, 17 Aug 2005 00:00:00 GMT
Last-Modified: Wed, 28 Feb 2018 16:27:28 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
X-Frame-Options: SAMEORIGIN
Content-Type: text/html; charset=utf-8
Set-Cookie: ee178549c4135355897a0fd336ea26d8=iccsu7vp1f99qvhgcbvbk8t102; path=/; HttpOnly
Connection: close