Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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:
    44,378
    Likes Received:
    1,857
    Trophy Points:
    363
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  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:
    44,378
    Likes Received:
    1,857
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Do you have any other redirects or .htaccess rules configured in the public_html directory or any other subdirectory?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice