How To Redirect Force your site from http to Https using .htaccess file

How to activate an SSL certificate for a website?

For Redirection, You need to add some in a .htaccess file (that located in file manager public_html folder).

Follow the steps:

  • Login To Cpanel >> File Manager >> Add File (from the Left hand corner ) >> Type the Name .htaccess >>¬† ¬†edit this file and Paste The codes
  • RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE] 
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
  • Put above code in your exiting .haccess file and then save that file.
  • Now Refresh your site and you see your site is fully Secure.

 

if you face any issue then leave a comment so we reply there and if work then also give your feedback.