How to Redirect HTTP to HTTPS Using htaccess?




HTTPS is the same data transfer protocol as HTTP but with support for cryptographic keys to encrypt and validate data. Set up a redirect from HTTP to HTTPS to improve security and correctly index the site. Follow this quick tutorial to learn how to redirect HTTP to HTTPS using a .htaccess file.

  • We highly recommend you back up your website.




Methods for Editing .htaccess File


There are several ways to edit a .htaccess file. Choose the most suitable for you:

  • the File Manager in cPanel;
  • local file editing on the computer and upload via FTP;
  • remote editing of the file in the FTP program through the Edit mode.




Redirecting HTTP to HTTPS


To redirect an HTTP request to HTTPS, just add code to your Joomla .htaccess file:

RewriteEngine On
​RewriteCond %{SERVER_PORT} 80RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]

Related articles