{"id":137,"date":"2019-05-13T11:10:38","date_gmt":"2019-05-13T11:10:38","guid":{"rendered":"https:\/\/blog.iabsolute.com\/?p=137"},"modified":"2019-05-13T11:10:38","modified_gmt":"2019-05-13T18:10:38","slug":"modifying-the-http-host-file-to-redirect-to-https","status":"publish","type":"post","link":"https:\/\/blog.iabsolute.com\/?p=137","title":{"rendered":"Modifying the HTTP Host File to Redirect to HTTPS"},"content":{"rendered":"\n<p>As it stands now, the server will provide both unencrypted HTTP and encrypted HTTPS traffic. For better security, it is recommended in most cases to redirect HTTP to HTTPS automatically. If you do not want or need this functionality, you can safely skip this section.<\/p>\n\n\n\n<p>To adjust the unencrypted Virtual Host file to redirect all traffic to be SSL encrypted, we can open the <code>\/etc\/apache2\/sites-available\/000-default.conf<\/code> file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\n\nsudo nano \/etc\/apache2\/sites-available\/000-default.conf\n\n\n<\/code><\/pre>\n\n\n\n<p>Inside, within the <code>VirtualHost<\/code> configuration blocks, we need to add a <code>Redirect<\/code> directive, pointing all traffic to the SSL version of the site:\n\/etc\/apache2\/sites-available\/000-default.conf\n<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;VirtualHost *:80>\n        . . .\n\n        Redirect \"\/\" \"https:\/\/your_domain_or_IP\/\"\n\n        . . .\n&lt;\/VirtualHost>\n<\/code><\/pre>\n\n\n\n<p>Save and close the file when you are finished.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As it stands now, the server will provide both unencrypted HTTP and encrypted HTTPS traffic. For better security, it is recommended in most cases to redirect HTTP to HTTPS automatically. If you do not want or need this functionality, you &hellip; <a href=\"https:\/\/blog.iabsolute.com\/?p=137\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-137","post","type-post","status-publish","format-standard","hentry","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=\/wp\/v2\/posts\/137","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=137"}],"version-history":[{"count":1,"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=\/wp\/v2\/posts\/137\/revisions"}],"predecessor-version":[{"id":138,"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=\/wp\/v2\/posts\/137\/revisions\/138"}],"wp:attachment":[{"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=137"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=137"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=137"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}