A
A
Artyom2017-09-26 00:20:55
Nginx
Artyom, 2017-09-26 00:20:55

301 redirect from one site with https to another?

Hello!
There are two domains.
From one of them you need to permanently move to the second.
The first one, despite the 301 redirect, must have the googlee3f18eddd1a9c602.html file available.
I tried this, but
server {
listen 80;
server_name ixley.ru www.ixley.ru ;
rewrite ^ $scheme://samox1n.ru$request_uri permanent;
}
server {
location = /googlee3f18eddd1a9c602.html {
root /var/www/ixley.ru;
}
location / {
return 301 https://samox1n.ru$request_uri;
}
}
server {
listen 443 ssl;
server_name ixley.ru www.ixley.ru *.ixley.ru;
rewrite ^ $scheme://samox1n.ru$request_uri permanent;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Mukovoz, 2017-09-28
@castomi

You obviously have a complete lack of understanding of how to compose Nginx rules. I highly recommend reading the Nginx documentation.
https://nginx.ru/ru/docs/beginners_guide.html
https://nginx.ru/ru/docs/http/ngx_http_core_module...
https://nginx.ru/ru/docs/http/server_names.html
https://nginx.ru/ru/docs/http/ngx_http_core_module...
https://nginx.ru/ru/docs/http/ngx_http_core_module...
https://nginx.ru/ru/docs/http/ ngx_http_rewrite_mod...

server {
 listen 80;
 listen 443 ssl;
 server_name ixley.ru www.ixley.ru ;
 location = /googlee3f18eddd1a9c602.html {
  root /var/www/ixley.ru;
 }
 location / {
  return 301 https://samox1n.ru$request_uri;
 }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question