301 Redirect http to https .htaccess code needed urgently

mickeyb44

Member
Sep 3, 2014
9
0
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
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,202
363
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.
 

mickeyb44

Member
Sep 3, 2014
9
0
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'
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,202
363
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.
 

mickeyb44

Member
Sep 3, 2014
9
0
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