+3 votes
by
Good day!
Can not solve the following problem:
Is there a website with a subdomain, for example onetwo.domain.com
You need to make when entering the address domain.com/one/two/ open website listed above, but in the address bar stayed the same introduced.
Don't know if this is possible, but it would be more so if you enter onetwo.domain.com occurred redirect domain.com/one/two with/ without cyclic redirect.

I wrote this code:
rewrite ^/one/two/ http://onetwo.domain.com/ last;
but at the address bar changing, since you need to specify a relative path, but how to do it with a subdomain I do not know.
by
Domain and subdomain on different machines?

2 Answers

0 votes
by
proxy_pass and address will remain unchanged.
That is, do not rewrite in location and proxy_pass onetwo.domain.com/; will receive the Ischia address that lives there where proxy_pass is specified.
0 votes
by
If all this is on one machine and a different system, it is possible to change the root depending on host. If it is one system, it can change through a single point of entry, depending on the request, i.e. shift work on the server side, for example:
server {
server_name domain.ru, sub.domain.ru;
if($host = sub.domain.ru) {
return 301 http://domain.ru$request_uri;
}
location / {
try_files $uri $uri/ /index.php?h=$host&q=$uri&$args;
}
}
by
Condition - Yes, a redirect, because the author wants to with the subdomain was redirecting to the main domain.
by
Isn't that a normal redirect?
...