Answer the question
In order to leave comments, you need to log in
Where is the error in setting up a 301 redirect?
Good afternoon.
The essence of the problem in a nutshell:
RewriteBase /
RewriteCond %{HTTP_HOST} ^(.+).pozdravunchik.ru$ [NC]
RewriteCond %{HTTP_HOST} !^www.pozdravunchik.ru$ [NC]
RewriteRule ^(.*)$ http://www.pozdravunchik.ru/$1 [NE,R=301,L]
RewriteCond %{SERVER_PORT} 80
RewriteCond %{SERVER_NAME} !^www.pozdravunchik.ru$ [NC]
RewriteRule ^(.*)$ http://www.pozdravunchik.ru/$1 [R=301,L]
RewriteCond %{SERVER_PORT} 443
RewriteCond %{SERVER_NAME} !^www.pozdravunchik.ru$ [NC]
RewriteRule ^(.*)$ https://www.pozdravunchik.ru/$1 [R=301,L]
server {
listen 80;
server_name pozdravunchik.ru;
return 301 https://www.$server_name$request_uri;
}
server {
listen 80;
server_name www.pozdravunchik.ru ;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
#ssl on;
ssl_certificate /etc/letsencrypt/live/www.pozdravunchik.ru/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/www.pozdravunchik.ru/privkey.pem; # managed by Certbot
server_name pozdravunchik.ru;
return 301 https://www.$server_name$request_uri;
}
server {
listen 443 ssl;
#ssl on;
ssl_certificate /etc/letsencrypt/live/www.pozdravunchik.ru/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/www.pozdravunchik.ru/privkey.pem; # managed by Certbot
server_name www.pozdravunchik.ru ;
Answer the question
In order to leave comments, you need to log in
The certificate was issued only on www.pozdravunchik.ru, but is also needed on pozdravunchik.ru.
Written 30 Jul.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question