Buenas, estoy configurando el vhost de NGINX para un sitio nuevo que funciona con wordpress, su url pongamos que es "www.ejemplo1.com" cuando accedo con www, nginx me lo redirecciona a ejemplo1.com para no tener contenido duplicado en ejemplo1.com y
www.ejemplo1.com
He instalado el plugin de yoast seo hace un par de dias y veo que google me ha indexado con "www" y sin las "www".
Para evitar contenido duplicado retiro las urls del google search console que tengan el subdominio www?
Configuración de NGINX
Código:
server {
server_name ejemplo1.com;
root /var/www/html/ejemplo1/www;
index index.php;
location / {
try_files $uri @apache;
# rewrite ^/([^\.]+)$ /index.php/$1 break;
}
location ~ ^/\.user\.ini {
deny all;
}
location ~* \.(svg|svgz)$ {
types {}
default_type image/svg+xml;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location @apache {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8080;
}
location ~[^?]*/$ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8080;
}
location ~ \.php$ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8080;
}
location ~/\. {
deny all;
access_log off;
log_not_found off;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/ejemplo1.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/ejemplo1.com/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
}
server {
if ($host = ejemplo1.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name ejemplo1.com;
listen 80;
return 404; # managed by Certbot
}
Gracias