Here is the exact code to redirect website from http to https using .htaccess file.
After installing SSL certificate for your website. Please follow the steps mentioned below to Redirect website from http to https using .htaccess file
- Login into your site cpanel.
- Open File Manager and get into public_html directory (check the option show hidden files).
- If you are not able to see .htaccess file in your file directory then Click on the right side top “Settings” icon and check the option show hidden files. Now you will be able to see the .htaccess file to edit.
- Select .htaccess file and open with code editor.
- Copy and Paste the below code in the starting of the
.htaccess file.
- Save it and open your site in the new tab and check it, your site will be redirected from http to https.
#Redirection code starts
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]#Redirection code Ends
Link – Download Redirection Code file
Please, comment below if your have any queries or doubts regarding to this article. Thanks
To be honest this tips might be much more helpful for the beginners.
thanks helpful
figured it out.
Its working
tnkQ bro it help me very much thankks a lot
thanks
truly grateful and thankful for your help. Sleep panda ukl
Good job ma this helped but when i copied it to my website it distorted the display of the entire site and i dont know what caused it. What should i do please its urgent. my website is http://www.plusworldroofing.com.ng
Thanks.
Please check for the hidden .htaccess file and add the code their… Don’t create new .htaccess file