How can we redirect HTTP to HTTPS using htaccess

It is very important to redirect HTTP to HTTPS using htaccess. After installing an SSL certificate, HostAngular automatically redirects the URL
The full form of SSL is “Secure Sockets Layer”. SSL certificate is used to create an encrypted channel between the client and the server. With an SSL certificate data was encrypted previously to be transmitted via the internet.