1. I have two domain names, www.a.com
and www.b.com
. Now I want all www.a.com access addresses to jump to www.b.com
, such as https://www.a.com/sample.html
to https://www.b.com/sample.html
.
2. The following is the nginx configuration of my domain name www.a.com
:
server{
listen 80;
server_name www.a.com a.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name a.com www.a.com;
index index.php index.html index.htm;
root /usr/share/nginx/iwwenbo;
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
ssl_certificate /etc/letsencrypt/live/a.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/a.com/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 60m;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include fastcgi_params;
}
}
I would like to ask how to modify to achieve the above functions, all the addresses of https://www.a.com/sample.html
will be transferred to https://www.b.com/sample.html
.
= update=
problem has been solved successfully. For more information on the solution, please see nginx configuration Jump between two domain names url (https configuration) ;