I want to redirect following URLs from old site to new website. Earlier, I had a mobile website now I want to remove the old website.
OLD - http://mobile.example.com - no need now
NEW - https://www.example.com
Currently, following URLs redirections are working fine.
https://mobile.example.com redirect to https://www.example.com - Not Working
https://mobile.example.com/adapter-xxx-adapter-white.html to https://www.example.com/adapter-xxx-adapter-white.html
If I try to open direct above webpage then it is opening on mobile website.
Possibly duplicate. The conf file as follows:
server {
listen 80;
# listen 443 ssl;
server_name mobile.example.com m.example.com mtest.example.com xxx.xx.xx.xx;
rewrite ^(.*) https://www.example.com$1 permanent;
}
server {
listen 80;
listen 443 ssl;
# Mobile website removed, as it should be redirect on main website
server_name example.com www.example.com;
ssl_certificate /etc/httpd/ssl/www.example.com.san.crt;
ssl_certificate_key /etc/httpd/ssl/www.example.com.key;
ssl_session_timeout 7m;
}
Ваш первый блок, предназначенный для перенаправления, не прослушивает порт SSL 443. Вероятно, это причина, по которой перенаправление https: // mobile => https: // www не работает.
Вместо этого рассмотрите возможность использования следующего блока:
server {
listen 80;
listen 443 ssl;
server_name mobile.example.com m.example.com mtest.example.com xxx.xx.xx.xx;
ssl_certificate FIXME;
ssl_certificate_key FIXME;
return 301 https://www.example.com$request_uri;
}