{"id":2127,"date":"2021-06-10T16:33:25","date_gmt":"2021-06-10T13:33:25","guid":{"rendered":"https:\/\/www.scalahosting.com\/kb\/?p=2127"},"modified":"2022-05-18T17:04:17","modified_gmt":"2022-05-18T14:04:17","slug":"redirect-http-to-https-automatically","status":"publish","type":"post","link":"https:\/\/www.scalahosting.com\/kb\/redirect-http-to-https-automatically\/","title":{"rendered":"Redirect HTTP to HTTPS Automatically"},"content":{"rendered":"<p><a href=\"https:\/\/www.scalahosting.com\/ssl-certificates.html\"><b>Secure Sockets Layer (<\/b><b><i>SSL<\/i><\/b><b>)<\/b><\/a><span style=\"font-weight: 400;\"> certificates help keep websites and visitors safer by encrypting data during browsing sessions. If you have implemented your SSL certificate, it is also advisable to redirect all HTTP requests to the<\/span><b> HTTPS URL<\/b><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><b>Redirecting HTTP to HTTPS can be done in several ways;<\/b><\/p>\n<h2><span style=\"font-weight: 400;\">Using the .htaccess File<\/span><\/h2>\n<p><img decoding=\"async\" class=\"aligncenter size-large wp-image-2128\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/File-Manager-URL-Redirect-1024x172.jpg\" alt=\"Redirect HTTP to HTTPS Automatically, Using the .htaccess File\" width=\"1024\" height=\"172\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/File-Manager-URL-Redirect-1024x172.jpg 1024w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/File-Manager-URL-Redirect-300x50.jpg 300w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/File-Manager-URL-Redirect-768x129.jpg 768w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/File-Manager-URL-Redirect.jpg 1333w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">The .htaccess file is a high-level server configuration file that is very useful, for example, in redirecting URL requests. <\/span><b>To redirect HTTP to HTTPS using this file;<\/b><\/p>\n<ol>\n<li><span style=\"font-weight: 400;\"> Access your web hosting control panel and launch the File Manager<\/span><\/li>\n<li><span style=\"font-weight: 400;\"> Find and open the .htaccess file for editing. You can usually find it in the <\/span><b>\u201cpublic_html\u201d <\/b><span style=\"font-weight: 400;\">directory or the main directory for your website.<\/span><\/li>\n<\/ol>\n<p><b>Add the following code to the file;<\/b><i><\/i><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><i><span style=\"font-weight: 400;\">RewriteCond %{SERVER_PORT} 80<\/span><\/i><\/li>\n<\/ul>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><i><span style=\"font-weight: 400;\">RewriteCond %{HTTP_HOST} ^(www\\.)?yourdomain\\.com<\/span><\/i><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><i><span style=\"font-weight: 400;\">RewriteRule ^(.*)$ https:\/\/www.yourdomain.com\/$1 [R,L]<\/span><\/i><\/li>\n<\/ul>\n<ol start=\"3\">\n<li><span style=\"font-weight: 400;\"> If the file does not exist, create a new file and add the following code;<\/span><\/li>\n<\/ol>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><i><span style=\"font-weight: 400;\">RewriteEngine On\u00a0<\/span><\/i><\/li>\n<\/ul>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><i><span style=\"font-weight: 400;\">RewriteCond %{SERVER_PORT} 80<\/span><\/i><\/li>\n<\/ul>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><i><span style=\"font-weight: 400;\">RewriteCond %{HTTP_HOST} ^(www\\.)?yourdomain\\.com<\/span><\/i><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><i><span style=\"font-weight: 400;\">RewriteRule ^(.*)$ https:\/\/www.yourdomain.com\/$1 [R,L]<\/span><\/i><\/li>\n<\/ul>\n<p><b>Save the file as .htaccess when exiting the editor<\/b><span style=\"font-weight: 400;\">.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Using WordPress<\/span><\/h2>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-2129\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/WordPress-URL.jpg\" alt=\"Redirect HTTP to HTTPS Automatically, Using WordPress\" width=\"780\" height=\"333\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/WordPress-URL.jpg 780w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/WordPress-URL-300x128.jpg 300w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/WordPress-URL-768x328.jpg 768w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">If you are using the <\/span><b>WordPress CMS&lt; it has a built-in URL redirector<\/b><span style=\"font-weight: 400;\">, you can send all HTTP requests to HTTPS URLs.<\/span><\/p>\n<ol>\n<li><span style=\"font-weight: 400;\"> Log in to your WordPress administration dashboard<\/span><\/li>\n<li><span style=\"font-weight: 400;\"> Hover over \u201cSettings\u201d on the left navigation bar, then click the \u201cGeneral\u201d option.<\/span><\/li>\n<li><span style=\"font-weight: 400;\"> You will need to update the <\/span><b>\u201cWordPress Address (URL)\u201d and \u201cSite Address (URL)\u201d<\/b><span style=\"font-weight: 400;\"> fields to include HTTPS. For example, if your URL is \u201chttp:\/\/www.youdomain.com,\u201d you should change it to \u201c<\/span><span style=\"font-weight: 400;\">https:\/\/www.yourdomain.com<\/span><span style=\"font-weight: 400;\">.\u201d<\/span><\/li>\n<\/ol>\n<p><b>Note:<\/b><span style=\"font-weight: 400;\"> In some instances, the URL area may be uneditable. This disabling of the edit box means you will not be able to make the amendments via the WordPress dashboard but need to edit the WordPress database tables instead.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Why HTTPS is Important<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Many search engines are now enforcing the use of SSL certificates. Visitors will see warning indicators when attempting to access websites that are not HTTPS certified. At the same time, search engines also <\/span><b>consider HTTPS as part of their search ranking algorithms.<\/b><\/p>\n<p><span style=\"font-weight: 400;\">You do not need a commercial SSL certificate in most cases. Non-commercial websites that do not handle user data can use<\/span><b> a free SSL from Let\u2019s Encrypt.<\/b><span style=\"font-weight: 400;\"> ScalaHosting offers the use of free SSL as well as makes commercial SSL from GeoTrust and Symantec available.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Secure Sockets Layer (SSL) certificates help keep websites and visitors safer by encrypting data during browsing sessions. If you have implemented your SSL certificate, it is also advisable to redirect all HTTP requests to the HTTPS URL. Redirecting HTTP to HTTPS can be done in several ways; Using the .htaccess File The .htaccess file is [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","_seopress_analysis_target_kw":"","footnotes":""},"categories":[40],"tags":[],"class_list":["post-2127","post","type-post","status-publish","format-standard","hentry","category-security"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/2127","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/comments?post=2127"}],"version-history":[{"count":2,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/2127\/revisions"}],"predecessor-version":[{"id":4540,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/2127\/revisions\/4540"}],"wp:attachment":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/media?parent=2127"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/categories?post=2127"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/tags?post=2127"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}