G
G
gremlintv22019-06-03 13:59:21
Nginx
gremlintv2, 2019-06-03 13:59:21

NGINX How to create a redirect like https://mysite.com/yabloki/$requvest_uri https://yabloki.mysite.com/?

Hello
How to create a view redirect

https://mysite.com/yabloki/$requvest_uri -> https://yabloki.mysite.com/

?
I found examples with the redirect of the subdomain to the url, but I’m still dealing with the data.
If it’s not difficult, please give an example using map
Thank you

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2019-06-03
@gremlintv2

one.

location /yabloki/ {
    rewrite ^/yabloki/(.*) http://yabloki.mysite.com/$1 permanent;
    return  403;
}

2.
server {

  listen 80;
  server_name example.com;

  location ~ ^/products/(.*)$ {
    proxy_pass http://catalog.example.com/$1;
  }

}

3.
server {
    # ...
    server_name domain.tld www.domain.tld;
    return 301 $scheme://subdomain.domain.tld$request_uri;
}

server {
    server_name subdomain.domain.tld;
    # ...
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question