我有一个重定向:
server {
server_name mydomain.com;
rewrite ^(.*) http://myanotherdomain.net/image$1 permanent;
}
当我进入mydomain.com/exemple时,一切正常,但是如何将mydomain.com指向我想要的地方?
我想: mydomain.com/test - > myanotherdomain.net/image/test(或者" test")和 mydomain.com - > myanotherdomain.net
有可能吗?
答案 0 :(得分:0)
server {
server_name mydomain.com;
location = / {
return 301 http://myanotherdomain.net;
}
location / {
return 301 http://myanotherdomain.net/image$request_uri;
}
}