Redirect site to SSL using apache and .htaccess

Posted at December 22, 2015 at 2:16 pm by John Quaglieri

A quick way to redirect your site to ssl, from non ssl can be done in a .htaccess file on apache webservers with mod_rewrite. Open .htaccess in a text editor.

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

replace ssl_domain.com with your domain. Using the rewrite rule ^(.*)$ anything included in the domain redirects to SSL. For example http://ssl_domain.com/page will redirect to https://ssl_domain.com/page.

3.00 avg. rating (64% score) - 3 votes

You can skip to the end and leave a response. Pinging is currently not allowed.

Leave a Reply