You can do this by adding the following code in your .htaccess
file:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yoursite.com/$1 [R,L]
</IfModule>
Don’t forget to replace yoursite.com
with your site URL.
If you are on NGINX
servers (most users are not), you would add the following to redirect from HTTP
to HTTPS
server {
listen 80;
server_name yoursite.com www.yoursite.com;
return 301 https://yoursite.com$request_uri;
}
By following these steps, you can force http to https