还有另一个nginx重定向问题。
我一直在尝试将domain.com/blog/post-1、/blog/post-2重定向到sub.domain.com/blog/post-1等。
有什么建议吗?
发布于 2012-05-18 03:53:15
如果您不想在没有子域的domain.com上提供任何服务,请添加此区块:
server {
server_name domain.com;
return 301 $scheme://sub.domain.com$request_uri;
}如果您想以某种方式使用它,请将以下内容添加到您的domain.com服务器块中:
location /blog {
rewrite ^ http://sub.domain.com$request_uri? permanent;
}当然,在任何情况下,您都需要捕获此请求的sub.domain.com服务器块。
https://stackoverflow.com/questions/10639932
复制相似问题