我正在尝试在nginx中将url重定向到非http协议(如test:// 123456),当我访问test.com / 123456时。 我尝试了以下重写:
rewrite ^ /(.*)$ test://$1 permanent;
它有效,但奇怪的是它添加了html / body头,这会破坏我的代码,是否有方法可以避免使用html头或其他推荐的方法来进行此类重写?
HTTP/1.1 301 Moved Permanently
Server: nginx/1.1.19
Date: Tue, 30 Apr 2013 14:14:47 GMT
Content-Type: text/html
Content-Length: 185
Connection: keep-alive
Location: test://123456
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.1.19</center>
</body>
</html>