{"id":91,"date":"2020-07-30T02:04:09","date_gmt":"2020-07-29T20:19:09","guid":{"rendered":"http:\/\/babal.host\/blog\/?p=91"},"modified":"2023-05-09T13:06:46","modified_gmt":"2023-05-09T07:21:46","slug":"how-to-automatically-redirect-http-traffic-to-https","status":"publish","type":"post","link":"https:\/\/babal.host\/blog\/how-to-automatically-redirect-http-traffic-to-https\/","title":{"rendered":"How to Automatically Redirect HTTP Traffic to HTTPS?"},"content":{"rendered":"\r\n<p>In 2021, its even more important to ensure that your website is served securely with proper SSL-encrypted connection for added security, PCI compliance, or accessibility. Its equally important to not only install the SSL certificate but force it on your website as well such that the website is never served insecure. The first stage for this starts with having a valid SSL certificate and a website that forces HTTPS on all calls.<\/p>\r\n\r\n\r\n\r\n<p>Babal Host provides a free SSL certificate as a standard in all our web hosting plans. It&#8217;s automatically installed and activated once you&#8217;ve added your domain and once the DNS for the same points to us. If the SSL certificate isn&#8217;t installed automatically, you can refer to the following article for &#8211; <a href=\"https:\/\/babal.host\/blog\/how-to-install-ssl-certificate-in-my-website\/\" target=\"_blank\" rel=\"noopener noreferrer\">How to install SSL certificate in my website?<\/a> If you&#8217;re still unable to resolve it, you can always <a href=\"https:\/\/clients.babal.host\/submitticket.php\" target=\"_blank\" rel=\"noopener noreferrer\">open a support ticket<\/a> from your client area, or connect with our friendly agents in our live chat.<br \/><br \/><strong>Video for forcing HTTPS with the use of .htaccess:<br \/><\/strong><\/p>\r\n<p><iframe loading=\"lazy\" title=\"Youtube Video Player\" src=\"https:\/\/www.youtube.com\/embed\/6216mX6nyxg\" width=\"100%\" height=\"500pt\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><span data-mce-type=\"bookmark\" style=\"display: inline-block; width: 0px; overflow: hidden; line-height: 0;\" class=\"mce_SELRES_start\">\ufeff<\/span><\/iframe><\/p>\r\n<p><strong>Blog for forcing HTTPS with the use of .htaccess:<\/strong><\/p>\r\n\r\n\r\n\r\n<p>The easiest way to accomplish this is by <strong>forcing HTTPS with the use of .htaccess<\/strong>. Here&#8217;s the step by step procedure for you to achieve this.<\/p>\r\n\r\n\r\n\r\n<ol class=\"wp-block-list\">\r\n<li>Open File Manager from your cPanel or FTP client<\/li>\r\n<li>Open the folder &#8220;public_html&#8221; from either the left-hand side menu box of the folder block as in the main display block\r\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-108\" src=\"https:\/\/babal.host\/blog\/wp-content\/uploads\/2020\/01\/open-public_htmp-1024x356.png\" alt=\"\" width=\"1024\" height=\"356\" srcset=\"https:\/\/babal.host\/blog\/wp-content\/uploads\/2020\/01\/open-public_htmp-1024x356.png 1024w, https:\/\/babal.host\/blog\/wp-content\/uploads\/2020\/01\/open-public_htmp-300x104.png 300w, https:\/\/babal.host\/blog\/wp-content\/uploads\/2020\/01\/open-public_htmp-768x267.png 768w, https:\/\/babal.host\/blog\/wp-content\/uploads\/2020\/01\/open-public_htmp-1536x534.png 1536w, https:\/\/babal.host\/blog\/wp-content\/uploads\/2020\/01\/open-public_htmp.png 1919w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\r\n<\/li>\r\n<li>Find &#8220;.htaccess&#8221; file. If you&#8217;re able to locate the file &#8211; skip to &#8220;Step 5&#8221; else click on Settings located at the top right part of the screen:<br \/>\r\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-109\" src=\"https:\/\/babal.host\/blog\/wp-content\/uploads\/2020\/01\/cPanel-settings-1024x112.png\" alt=\"\" width=\"1024\" height=\"112\" srcset=\"https:\/\/babal.host\/blog\/wp-content\/uploads\/2020\/01\/cPanel-settings-1024x112.png 1024w, https:\/\/babal.host\/blog\/wp-content\/uploads\/2020\/01\/cPanel-settings-300x33.png 300w, https:\/\/babal.host\/blog\/wp-content\/uploads\/2020\/01\/cPanel-settings-768x84.png 768w, https:\/\/babal.host\/blog\/wp-content\/uploads\/2020\/01\/cPanel-settings-1536x168.png 1536w, https:\/\/babal.host\/blog\/wp-content\/uploads\/2020\/01\/cPanel-settings.png 1919w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\r\n<\/li>\r\n<li>On the box that pops out, check the box next to &#8220;Show hidden files (dotfiles)&#8221; and click on &#8220;Save&#8221;:<br \/>\r\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-924 size-full\" src=\"https:\/\/babal.host\/blog\/wp-content\/uploads\/2020\/07\/show-hidden-files.png\" alt=\"\" width=\"630\" height=\"420\" srcset=\"https:\/\/babal.host\/blog\/wp-content\/uploads\/2020\/07\/show-hidden-files.png 630w, https:\/\/babal.host\/blog\/wp-content\/uploads\/2020\/07\/show-hidden-files-300x200.png 300w\" sizes=\"auto, (max-width: 630px) 100vw, 630px\" \/><\/figure>\r\n<\/li>\r\n<li>You should now be able to locate &#8220;.htaccess&#8221; in your File Manager. Select it and click on &#8220;Edit&#8221; as shown in the image to make changes to this file:<br \/>Add the following line of code at the top of your .htaccess file and click on &#8220;Save&#8221;:<\/li>\r\n<\/ol>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">RewriteEngine On \r\nRewriteCond %{HTTPS} !on \r\nRewriteCond %{REQUEST_URI} !^\/[0-9]+\\..+\\.cpaneldcv$ \r\nRewriteCond %{REQUEST_URI} !^\/\\.well-known\/pki-validation\/[A-F0-9]{32}\\.txt(?:\\ Comodo\\ DCV)?$ \r\nRewriteRule (.*) https:\/\/%{HTTP_HOST}%{REQUEST_URI} [L,R=301]<\/pre>\r\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-925 size-full\" src=\"https:\/\/babal.host\/blog\/wp-content\/uploads\/2020\/07\/update-htaccess.png\" alt=\"\" width=\"1024\" height=\"338\" srcset=\"https:\/\/babal.host\/blog\/wp-content\/uploads\/2020\/07\/update-htaccess.png 1024w, https:\/\/babal.host\/blog\/wp-content\/uploads\/2020\/07\/update-htaccess-300x99.png 300w, https:\/\/babal.host\/blog\/wp-content\/uploads\/2020\/07\/update-htaccess-768x254.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\r\n\r\n\r\n\r\n<p>Congratulations! Your website will now be served with forced HTTPS. Do ensure that all your links are converted to https to be able to see the full impact of the same. If you&#8217;re using WordPress, you can refer to our article here on <a href=\"https:\/\/babal.host\/blog\/how-to-update-all-http-urls-to-https-in-wordpress\/\" target=\"_blank\" rel=\"noopener noreferrer\">how to update all http links to https<\/a>. This is how the website URL bar looked like before the code was placed:<\/p>\r\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-926 size-full\" src=\"https:\/\/babal.host\/blog\/wp-content\/uploads\/2020\/07\/insecure-URL-bar.png\" alt=\"\" width=\"369\" height=\"46\" srcset=\"https:\/\/babal.host\/blog\/wp-content\/uploads\/2020\/07\/insecure-URL-bar.png 369w, https:\/\/babal.host\/blog\/wp-content\/uploads\/2020\/07\/insecure-URL-bar-300x37.png 300w\" sizes=\"auto, (max-width: 369px) 100vw, 369px\" \/><\/figure>\r\n\r\n\r\n\r\n<p>This is how your website will look after the code is in place, and if you click on the padlock &#8220;secure icon&#8221; &#8211; this or similar view is what you&#8217;ll see.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-927 size-full\" src=\"https:\/\/babal.host\/blog\/wp-content\/uploads\/2020\/07\/secure-URL-bar.png\" alt=\"\" width=\"402\" height=\"381\" srcset=\"https:\/\/babal.host\/blog\/wp-content\/uploads\/2020\/07\/secure-URL-bar.png 402w, https:\/\/babal.host\/blog\/wp-content\/uploads\/2020\/07\/secure-URL-bar-300x284.png 300w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/figure>\r\n\r\n\r\n\r\n<p>&nbsp;<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>In 2021, its even more important to ensure that your website is served securely with proper SSL-encrypted connection for added security, PCI compliance, or accessibility. Its equally important to not only install the SSL certificate but force it on your website as well such that the website is never served insecure. The first stage for [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":105,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[],"class_list":["post-91","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-babal-guide"],"_links":{"self":[{"href":"https:\/\/babal.host\/blog\/wp-json\/wp\/v2\/posts\/91","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/babal.host\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/babal.host\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/babal.host\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/babal.host\/blog\/wp-json\/wp\/v2\/comments?post=91"}],"version-history":[{"count":17,"href":"https:\/\/babal.host\/blog\/wp-json\/wp\/v2\/posts\/91\/revisions"}],"predecessor-version":[{"id":1367,"href":"https:\/\/babal.host\/blog\/wp-json\/wp\/v2\/posts\/91\/revisions\/1367"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/babal.host\/blog\/wp-json\/wp\/v2\/media\/105"}],"wp:attachment":[{"href":"https:\/\/babal.host\/blog\/wp-json\/wp\/v2\/media?parent=91"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/babal.host\/blog\/wp-json\/wp\/v2\/categories?post=91"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/babal.host\/blog\/wp-json\/wp\/v2\/tags?post=91"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}