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.

SOLVED http to https

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

  1. canou83

    canou83 Well-Known Member

    Joined:
    Jul 20, 2016
    Messages:
    62
    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]
     
    #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,398
    Likes Received:
    52
    Trophy Points:
    28
    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]
     
  3. canou83

    canou83 Well-Known Member

    Joined:
    Jul 20, 2016
    Messages:
    62
    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
     
  4. cPanelJasonT

    cPanelJasonT Level 2 Technical Analyst
    Staff Member

    Joined:
    Oct 21, 2014
    Messages:
    55
    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.
     
Loading...

Share This Page