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.

301 Redirect http to https .htaccess code needed urgently

Discussion in 'General Discussion' started by mickeyb44, Sep 3, 2014.

  1. mickeyb44

    mickeyb44 Member

    Joined:
    Sep 3, 2014
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Hi all,

    Ive had a very basic website for a friend on aso for years.

    Now I wish to move my own website to a startup business package.

    However, this package applies https to every page and all my google links are http, ive been searching for hours to find a pre written code for how to perform a google friendly 301 redirect for the entire http site to https

    Can anyone help, ive been to the relevant google websmaster page and apache pages but I just don't understand it all enough.

    All I know is that I have to open wordpad, paste the code, save as .htaccess and ftp to server root.

    Thanks in advance,

    Michael
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

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

    Have you considered using the "Redirects" option in cPanel? Or, if you prefer to edit the .htaccess file directly, this post should help:

    Force use of SSL

    Thank you.
     
  3. mickeyb44

    mickeyb44 Member

    Joined:
    Sep 3, 2014
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Many thanks for your lightning fast reply !

    I wish my shopping cart software sellers were the same as you.

    Are you saying I can do this:

    Open wordpad
    create empty file called .htaccess
    Paste this code:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^yourwebsite\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.yourwebsite\.com$
    RewriteRule ^(.*)$ "https\:\/\/yourwebsite\.com\/$1" [R=301,L]

    Upload to root directory on aso ?

    Is that all correct and 100% server friendly

    Michael

    - - - Updated - - -

    Obviously putting my domain in not 'yourwebsite'
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,762
    Likes Received:
    662
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Yes, that is correct. However, note that if your script already uses custom Mod_Rewrite rules you may have to adjust them accordingly.

    Thank you.
     
  5. mickeyb44

    mickeyb44 Member

    Joined:
    Sep 3, 2014
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Many thanks,

    Does the cpanel redirect option work in the same way and is it as good and google friendly as the htaccess one ?

    Michael
     
  6. cPanelPeter

    cPanelPeter Technical Analyst III
    Staff Member

    Joined:
    Sep 23, 2013
    Messages:
    569
    Likes Received:
    15
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    Yes, the cPanel redirect should work just fine and be "Google Friendly".
     
  7. mickeyb44

    mickeyb44 Member

    Joined:
    Sep 3, 2014
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Ok thanks, just signed up and in cpanel already.
    I have a few more questions, will search before posting.

    Michael
     
Loading...

Share This Page