nginx 301重写根域工作但文件没有被重定向

时间:2013-06-14 22:09:29

标签: url-rewriting nginx rewrite

我正在尝试将域重定向到nginx中的另一个域,但它可以部分工作。

看起来像这样:

location /  {
             rewrite ^/(.*) http://www.some_domain.tld/some_dir/some_file.php permanent;
}

它重定向根域,但是如果我尝试加载http://www.my_old_domain.tld/some_file.php,它将不会这样做。它会加载页面。

想法?

感谢。

1 个答案:

答案 0 :(得分:0)

尝试使用此

location /
    return 301 http://newdomain.com/a/b/c.php;
}
相关问题