HTTP to HTTPS Redirect Permanently

Forcing the use of HTTPS:// on your site will ensure that visitors to your site are always using and aren't able to access an insecure URL. This is recommended since if a visitor does access your site as everything will be marked as "Not Secure".

Below code is for forcing HTTPs on an Apache webserver. If you are using another webserver such as lighttpd, nginx, etc you will need to contact your web hosting provider for assistance.

Add the following code to the .htaccess file in your webhosting account using File Manager in Public_html Directory:

RewriteCond %{HTTP_HOST} YourWebAddress\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$$1 [R,L]


Once this change is made your site will no longer be accessible on the insecure "" URLs and all visitors will be redirected to "" instead.

  • ssl, auto ssl, http to https, https redirection, .htaccess, force https, hostic tutorials
  • 20 Users Found This Useful
Was this answer helpful?