The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Redirecttions after SSL certificate installation

Discussion in 'Security' started by Hagai Shaul, Feb 19, 2015.

  1. Hagai Shaul

    Hagai Shaul Member

    Joined:
    Apr 2, 2014
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    HELLO

    I installed ssl cert to my website (example domain name - http://8websitename8.com without www) and I want to know how to make the redirection in the htaccess file inside the root directory so any other link will point to https://8websitename8.com (with https).

    I succeeded to do the following (For other members who will see this post :)
    RewriteCond %{HTTP_HOST} ^www.8websitename8.com$ [OR]
    RewriteCond %{HTTP_HOST} http://www.8websitename8.com$ [OR]
    RewriteCond %{HTTP_HOST} http://8websitename8.com$
    RewriteRule ^(.*)$ https://8websitename8.com/$1 [R=301]


    I also want to redirect https://www.8websitename8.com/ (with https and www) to https://8websitename8.com/
    (with https and without www) because now it gives ssl error about the authentication of this certificate.

    I tried to do the following but it did not work

    RewriteCond %{HTTP_HOST} https://www.8websitename8.com$
    RewriteRule ^(.*)$ https://8websitename8.com/$1 [R=301]


    and also

    RewriteCond %{SERVER_PORT} 443
    RewriteCond %{HTTP_HOST} https://www.8websitename8.com$
    RewriteRule ^(.*)$ https://8websitename8.com/$1 [R=301]


    I do all of this so the website will not have duplicate content - for seo.

    I will appreciate any help.

    Many thanks
    Hagai Shaul
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,789
    Likes Received:
    665
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    You could try an entry in the .htaccess file like this:

    Code:
    RewriteEngine On 
    RewriteCond %{HTTP_HOST} ^domain\.com [NC]
    RewriteCond %{SERVER_PORT} 80 
    RewriteRule ^(.*)$ https://domain.com/$1 [R,L]
    Thank you.
     
  3. Hagai Shaul

    Hagai Shaul Member

    Joined:
    Apr 2, 2014
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi Michael
    Thanks very much.
    Yorks great :)

    - - - Updated - - -

    Hi
    I had a mistake. I think it happend because of a cache in the browser.
    I tried to do it and I received the same error.
     
  4. Hagai Shaul

    Hagai Shaul Member

    Joined:
    Apr 2, 2014
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    To be more precise - The error is:

     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,789
    Likes Received:
    665
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page