Redirecting to SSL using Apache’s htaccess

Just edit the .htacess file and add the below lines.

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ http://www.test.com/$1 [L,R=301]