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!

SOLVED http to https

Discussion in 'Bind/DNS/Nameserver' started by canou83, May 14, 2017.

  1. canou83

    canou83 Well-Known Member

    Joined:
    Jul 20, 2016
    Messages:
    77
    Likes Received:
    7
    Trophy Points:
    8
    Location:
    France
    cPanel Access Level:
    Website Owner
    What about htaccess?

    The current code is this one. But what do I need to add to redirect to https? Must I change something in the current htaccess?

    It really does not have to lose the url in the google results. Thanks for your help.
    Code:
    
    # SEO URL Settings
    RewriteEngine On
    # If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/
    
    RewriteBase /
       RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
       RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
       RewriteRule ^download/(.*) /index.php?route=error/not_found [L]
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
       RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
       RewriteCond %{HTTP_HOST} ^mysite.com$
       RewriteRule ^(.*) http://www.mysite.com/$1 [QSA,L,R=301]
       RewriteCond %{QUERY_STRING} ^(.*)common/home(.*)$
       RewriteRule ^index\.php$ Website Hosting - Mysite.com [L,R=301]
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #1 canou83, May 14, 2017
    Last edited by a moderator: May 14, 2017
  2. 24x7server

    24x7server Well-Known Member

    Joined:
    Apr 17, 2013
    Messages:
    1,880
    Likes Received:
    89
    Trophy Points:
    78
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Hi,

    Try adding below codes in the .htaccess file to see if it works for you.

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


    OR

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. canou83

    canou83 Well-Known Member

    Joined:
    Jul 20, 2016
    Messages:
    77
    Likes Received:
    7
    Trophy Points:
    8
    Location:
    France
    cPanel Access Level:
    Website Owner
    Ih 24x7sever. I tried this :


    Code:
     RewriteCond %{HTTPS} off
     RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    It seems to work
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. cPanelJasonT

    cPanelJasonT Level 2 Technical Analyst
    Staff Member

    Joined:
    Oct 21, 2014
    Messages:
    54
    Likes Received:
    6
    Trophy Points:
    83
    cPanel Access Level:
    Root Administrator
    Hello,
    Thanks for the update. It does appear that the solution has been found here.
     
    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