How to Force Redirect HTTP to HTTPS using htaccess? - ExonHost

Published: 01 January 1970
on channel: ExonHost
934
22

New to our channel subscribe http://bit.ly/ExonHostY.

#SSL #HTTPS

By default site reach with http://, Once an SSL certificate is installed and the site can be reached via https:// appropriately, you might want to make it accessible via https:// by default. In other words, by typing domain.com in a web-browser, a user should be redirected to https://domain.com to access the site securely.

You can force an HTTPS connection on your website by adding these rules in your website’s .htaccess file. The file itself can be found if you go to cPanel then File Manager. There, find the document root of your website. For primary cPanel domains, the folder is usually ‘public_html’. If the website is an add-on, you can look up its document root in Addon domains section.

When you find the folder, the .htaccess file may already be there. To double-check it, click Settings in the top-right corner and tick Show hidden files (dotfiles).

If you don’t find the .htaccess there, feel free to create it by clicking +File. Make sure to name the file .htaccess, starting with the dot.

To open the file, right-click it, then click Edit. A warning box will pop up, but click on Edit.

Paste the following code and save the file.

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
Header always set Content-Security-Policy "upgrade-insecure-requests;"

Website ? https://www.exonhost.com
Like Us ?   / exonhost  
Follow Us ?   / exonhost  
Subscribe Us? http://bit.ly/ExonHostY Pin Us?
  / exonhost  


On this page of the site you can watch the video online How to Force Redirect HTTP to HTTPS using htaccess? - ExonHost with a duration of hours minute second in good quality, which was uploaded by the user ExonHost 01 January 1970, share the link with friends and acquaintances, this video has already been watched 934 times on youtube and it was liked by 22 viewers. Enjoy your viewing!