Knowledge Base » Blog Archive » How to force SSL (redirect) using .htaccess

How to force SSL (redirect) using .htaccess

August 4th, 2016


When your website has SSL enabled, you may want to force all traffic to be served over the SSL encrypted connection only. This can easily be achieved by adding the code below in your .htaccess file. If you have any redirect codes in your .htaccess file, we recommend adding this before that and verifying that no other redirect code is redirecting back to http:// non-SSL URLs.

The code to be added in your .htaccess file is as follows. Replace with your own domain.

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$$1 [R,L]


To enable SSL for WordPress websites, please follow the steps below:

  • Log in to WordPress as the administrator.
  • On the left-hand menu, click Settings, and then click General.
  • Under General Settings, in the WordPress Address (URL) text box, replace the current http:// URL with the secure https:// URL of your website such as
  • Use the same URL in the Site Address (URL) texts box as well
  • Click Save Changes.