Question
How to Redirect all HTTP requests to HTTPS? This Query is unique!!!
Hey everyone, I recently have moved to HTTPS version from HTTP. But since then, I am into trouble and problem is not solved.
So, my query is, How to redirect user to HTTPS version of site regardless whatever he types. For ex., Let me explain:-
example.com —>>> `https:// www.example.com/
www.example.com —>>> https:// www.example.com/
https:// example.com —>>> https:// www.example.com/
Moreover, If in future I make my mind to move site to https:// example.com instead of https:// www.example.com, then what will be the code for this? Let me give example for this too.
example.com —>>> https:// example.com/
www.example.com —>>> https:// example.com/
https:// www.example.com —>>> https:// example.com/
I have seen that if a user types https:// example.com and I want it to redirect to https:// www.example.com/ then browser give warning about its security before redirecting. Hence, asks for users confirmation. This is bad thing and can destroy site owner image. This should not happen. :D
Please suggest .htaccess code for both types separately. For info, using Apache Web Server. :D
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×