admin管理员组文章数量:1425661
Hi there could somedoby explain please why https://www. SUBdomain does not redirect to
I am running nginx and seems like set up all the redirects but the one above seem to be redirected wrongly by Wordpress, I have all A records set up 2 for http version of main domain with and without www and two for https records. My config redirects are below. WordPress Address (URL) and Site Address (URL) are set to https://maindomain not sure if this is the issue and how to resolve it
#Main domain confing
server {
server_name domain.club;
access_log /var/www/bclub/logs/access.log;
error_log /var/www/bclub/logs/error.log;
root /var/www/bclub/;
index index.php index.html index.htm index.nginx-debian.html;
listen [::]:443 ssl http2; # managed by Certbot
listen 443 ssl http2; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/domain.club/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/domain.club/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
add_header Strict-Transport-Security "max-age=31536000" always; # managed by Certbot
ssl_trusted_certificate /etc/letsencrypt/live/domain.club/chain.pem; # managed by Certbot
ssl_stapling on; # managed by Certbot
ssl_stapling_verify on; # managed by Certbot
}
server {
listen 80;
server_name domain.club www.domain.club;
return 301 $request_uri;
}
#SUB-domain confing
server {
server_name cdn.domain.club www.cdn.domain.club;
access_log /var/www/cdn.bclub/logs/access.log;
error_log /var/www/cdn.bclub/logs/error.log;
root /var/www/cdn.bclub;
index index.php index.html index.htm index.nginx-debian.html;
etag off;
listen 443 ssl http2; # managed by Certbot
listen [::]:443 ssl http2; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/domain.club/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/domain.club/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
add_header Strict-Transport-Security "max-age=31536000" always; # managed by Certbot
ssl_trusted_certificate /etc/letsencrypt/live/domain.club/chain.pem; # managed by Certbot
ssl_stapling on; # managed by Certbot
ssl_stapling_verify on; # managed by Certbot
}
server {
listen 80;
server_name cdn.domain.club www.cdn.domain.club;
return 301 $request_uri;
}
Many thanks
Hi there could somedoby explain please why https://www. SUBdomain does not redirect to https://non-www.sudomain
I am running nginx and seems like set up all the redirects but the one above seem to be redirected wrongly by Wordpress, I have all A records set up 2 for http version of main domain with and without www and two for https records. My config redirects are below. WordPress Address (URL) and Site Address (URL) are set to https://maindomain not sure if this is the issue and how to resolve it
#Main domain confing
server {
server_name domain.club;
access_log /var/www/bclub/logs/access.log;
error_log /var/www/bclub/logs/error.log;
root /var/www/bclub/;
index index.php index.html index.htm index.nginx-debian.html;
listen [::]:443 ssl http2; # managed by Certbot
listen 443 ssl http2; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/domain.club/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/domain.club/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
add_header Strict-Transport-Security "max-age=31536000" always; # managed by Certbot
ssl_trusted_certificate /etc/letsencrypt/live/domain.club/chain.pem; # managed by Certbot
ssl_stapling on; # managed by Certbot
ssl_stapling_verify on; # managed by Certbot
}
server {
listen 80;
server_name domain.club www.domain.club;
return 301 https://domain.club$request_uri;
}
#SUB-domain confing
server {
server_name cdn.domain.club www.cdn.domain.club;
access_log /var/www/cdn.bclub/logs/access.log;
error_log /var/www/cdn.bclub/logs/error.log;
root /var/www/cdn.bclub;
index index.php index.html index.htm index.nginx-debian.html;
etag off;
listen 443 ssl http2; # managed by Certbot
listen [::]:443 ssl http2; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/domain.club/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/domain.club/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
add_header Strict-Transport-Security "max-age=31536000" always; # managed by Certbot
ssl_trusted_certificate /etc/letsencrypt/live/domain.club/chain.pem; # managed by Certbot
ssl_stapling on; # managed by Certbot
ssl_stapling_verify on; # managed by Certbot
}
server {
listen 80;
server_name cdn.domain.club www.cdn.domain.club;
return 301 https://cdn.domain.club$request_uri;
}
Many thanks
Share Improve this question edited Jun 17, 2019 at 12:47 mag8891 asked Jun 17, 2019 at 12:42 mag8891mag8891 12 bronze badges2 Answers
Reset to default 0WordPress Address (URL) and Site Address (URL) are set to https://maindomain
I mean, there's your answer. WordPress uses the URL you set in Settings as the canonical URL.
I have found the solution add below code to subdomain config solved it!
#Redirect WWW to non-www
if ($host = www.cdn.domain.club) {
rewrite ^(.*) https://cdn.domain.club$request_uri? permanent;
}
本文标签: redirectWhy httpswww SUBdomain is redirected by WP to httpsMAINdomain
版权声明:本文标题:redirect - Why https:www. SUBdomain is redirected by WP to https:MAINdomain 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745394207a2656738.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论