{"id":1225,"date":"2018-12-18T15:05:13","date_gmt":"2018-12-18T15:05:13","guid":{"rendered":"https:\/\/chemicloud.com\/kb\/?post_type=article&#038;p=1225"},"modified":"2021-01-14T21:57:01","modified_gmt":"2021-01-14T21:57:01","slug":"redirect-http-to-https","status":"publish","type":"ht_kb","link":"https:\/\/chemicloud.com\/kb\/article\/redirect-http-to-https\/","title":{"rendered":".htaccess 101 &#8211; Redirect HTTP Requests to HTTPS"},"content":{"rendered":"<p>Once you have purchased and installed an\u00a0<a href=\"https:\/\/lab.chemicloud.com\/store\/ssl-certificates\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>SSL Certificate<\/strong><\/a>, you should automatically redirect visitors to the secure version of your website ( <strong>https:\/\/<\/strong> ).<\/p>\n<p>This ensures data sent to and from your website is securely encrypted. Besides this, according to Google \u2013 HTTPS is now a ranking signal among some other factors.<\/p>\n<p>If you are a ChemiCloud customer, you can easily redirect HTTP to HTTPS requests using the <a href=\"https:\/\/chemicloud.com\/kb\/article\/force-https-redirect-in-cpanel\/\" target=\"_blank\" rel=\"noopener noreferrer\">force HTTPS redirect<\/a> feature in cPanel.<\/p>\n<h2 id=\"how-to-manually-redirect-http-requests-to-https-using-htaccess\">How to Manually Redirect HTTP Requests to HTTPS using .htaccess<\/h2>\n<p>However, if for some reason your website is not working after you enabled the force redirect in cPanel, you should try to do this via your .htaccess file.<\/p>\n<p>1) Edit\/Create a .htaccess file in the folder your site is being served from (normally public_html). You can easily edit the .htaccess file using an <a href=\"https:\/\/chemicloud.com\/kb\/article\/how-to-use-ftp\/\" target=\"_blank\" rel=\"noopener noreferrer\">FTP client<\/a> or through the online <a href=\"https:\/\/chemicloud.com\/kb\/article\/use-file-manager-cpanel\/\" target=\"_blank\" rel=\"noopener noreferrer\">File Manager<\/a> in cPanel.<\/p>\n<p>2) Add the following code to the .htaccess file:<\/p>\n<pre># BEGIN HTTPS Redirect\r\nRewriteEngine On\r\nRewriteCond %{HTTPS} off\r\nRewriteRule ^(.*)$ https:\/\/%{HTTP_HOST}%{REQUEST_URI} [L,R=301]\r\n# END HTTPS Redirect<\/pre>\n<p>3) Save the file and check the results in your web browser by trying to access your site using standard HTTP rather than HTTPS.<\/p>\n<p>If it is working\u00a0correctly, you should be\u00a0automatically\u00a0redirected to https.<\/p>\n    \t\t<div class=\"hts-messages hts-messages--info   hts-messages--withicon \"   >\r\n    \t\t\t    \t\t\t    \t\t\t\t<p>\r\n    \t\t\t\t\tPlease Note: If you do not have an SSL certificate installed, this could cause errors. Please make sure that you have an SSL certificate installed and properly working before\u00a0attempting\u00a0this.    \t\t\t\t<\/p>\r\n    \t\t\t    \t\t\t\r\n    \t\t<\/div><!-- \/.ht-shortcodes-messages -->\r\n    \t\t\n<h2 id=\"how-to-fix-mixed-content-warnings-insecure-requests\">How to fix mixed content warnings (insecure requests)<\/h2>\n<p>Once doing the redirect from HTTP to HTTPS, if you are facing SSL <a href=\"https:\/\/chemicloud.com\/kb\/article\/fix-mixed-content-warnings\/\" target=\"_blank\" rel=\"noopener noreferrer\">mixed content warnings<\/a>,\u00a0you only need to add the following lines of code to your site\u2019s .htaccess file:<\/p>\n<pre># BEGIN Fix mixed content warnings\r\n&lt;ifModule mod_headers.c&gt;\r\nHeader always set Content-Security-Policy \"upgrade-insecure-requests;\"\r\n&lt;\/IfModule&gt;\r\n# END Fix mixed content warnings<\/pre>\n<p>As always, our customer support team is here to answer any questions you may have!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Once you have purchased and installed an\u00a0SSL Certificate, you should automatically redirect visitors to the secure version of your website ( https:\/\/ ). This ensures data sent to and from your website is securely encrypted. Besides this, according to Google \u2013 HTTPS is now a ranking signal among some other&#8230;<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"ht-kb-category":[190],"ht-kb-tag":[],"class_list":["post-1225","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-domains"],"_links":{"self":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb\/1225","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/comments?post=1225"}],"version-history":[{"count":21,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb\/1225\/revisions"}],"predecessor-version":[{"id":4370,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb\/1225\/revisions\/4370"}],"wp:attachment":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/media?parent=1225"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb-category?post=1225"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb-tag?post=1225"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}