Announcement

Collapse
No announcement yet.

https non-www to www redirect

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • https non-www to www redirect

    Hello,

    See the following config:

    Code:
    server {
       listen         80;
       server_name    webhosting.uk.com www.webhosting.uk.com;
       return         301 https://www.webhosting.uk.com$request_uri;
    }
    
    #server {
    #       listen          443 ssl;
    #       server_name     webhosting.uk.com;
    #       return          301 https://www.webhosting.uk.com$request_uri;
    #}
    
    server {
        listen 443 ssl;
    
        ssl on;
        ssl_certificate ...
        { ssl stuff }
        ...
        server_name www.webhosting.uk.com;
        ...
    Itís broken while I uncomment second server block to allow redirect from https://webhosting.uk.com to https://www.webhosting.uk.com.

  • #2
    Have you tried to put a server_name webhosting.uk.com or some sort of alias in third block?

    Comment


    • #3
      In third block, I just updated the question there is server_name www.webhosting.uk.com .

      Comment


      • #4
        Hi ELI,
        It seems you didn't include SSL certificates, etc. for https://webhosting.uk.com in the second block, and so it unable to operate on 443.

        Comment


        • #5
          Originally posted by Nimbus View Post
          Hi ELI,
          It seems you didn't include SSL certificates, etc. for https://webhosting.uk.com in the second block, and so it unable to operate on 443.
          Thanks, Nimbus. Your solution has been worked perfectly.

          Comment

          Working...
          X