After your .htaccess
file. Adding a few lines to your .htaccess
file will automatically redirect your visitors to the HTTPS version of your website.
.htaccess
if you already have one. If not, click File+, name the file .htaccess
and click Create New File..htaccess
file, and click Edit. .htaccess
file, use the following code to set up the URL redirect to the HTTPS version of your website: RewriteEngine On RewriteCond %{SERVER_PORT} 80RewriteCond %{HTTP_HOST} ^(www\.)?coolexample\.comRewriteRule ^(.*)$ https://www.coolexample.com/$1 [R,L]
.htaccess
file already exists in your hosting account, do not duplicate ReWriteEngine On
. Insert the lines that begin with ReWriteCond
and RewriteRule
directly after the already existing ReWriteEngine On
.Visit your website and you'll automatically be re-directed to the HTTPS version.
We provide these instructions as a courtesy, but you may need to make other changes to get the redirect working if you already have a .htaccess
file.