-1

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.

  1. http://mobile.example.com redirect to https://www.example.com - Working
  2. https://mobile.example.com redirect to https://www.example.com - Not Working

  3. https://mobile.example.com/adapter-xxx-adapter-white.html to https://www.example.com/adapter-xxx-adapter-white.html

    • Not Working

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;

}
4
  • Please include your complete nginx configuration, because it includes relevant information for the question. Jul 25, 2017 at 13:15
  • where it is located ?
    – sandip
    Jul 25, 2017 at 13:35
  • It is impossible to tell without knowing your setup. Jul 25, 2017 at 16:19
  • Will update the question tomorrow
    – sandip
    Jul 25, 2017 at 16:40

1 Answer 1

1

Your first block that you intended for redirections does not listen for SSL port 443. That is likely a reason why redirection https://mobile => https://www is not working.

Consider using the following block instead:

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;
}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .