У меня есть поддомен something.site.com. На моем основном сайте site.com/something я хотел бы переписать его на something.site.com, но сохранил url site.com/something без изменений.
Это то, что я могу сделать с правилами перезаписи nginx?
Вам нужно будет изучить proxy_pass вместо перезаписи.
Например:
server {
server_name site.com
location /something {
# you may use rewrites here to re-format the path portion of the
# URL before passing it on.
# e.g.: rewrite ^/(abc) /def last;
proxy_pass http://something.site.com; # Proxy on the request, without redirecting.
}
}
Цитата из документации, я не думаю, что это возможно:
If the replacement string begins with http:// then the client will be redirected, and any further rewrite directives are terminated.