How to redirect http to https forcefully

HTTPS provides authentication of the website and associated web server with which one is communicating, which protects against man-in-the-middle attacks.

Additionally, it provides bidirectional encryption of communications between a client and server, which protects against eavesdropping and tampering with or forging the contents of the communication.
HTTPS connections were primarily used for payment transactions on the World Wide Web, e-mail and for sensitive transactions in corporate information systems.
So if you want to force https on entire website, create a file named .htaccess and just copy and paste the below code

After following this post your website use HTTPS while redirecting.