Install modules

Enable modules

Method 1

using rewrite module

RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] </VirtualHost>

Method 2

using redirect method

Redirect permanent / https://www.yourdomain.com/ </VirtualHost>