{"id":555,"date":"2012-07-10T10:59:28","date_gmt":"2012-07-10T02:59:28","guid":{"rendered":"http:\/\/rmohan.com\/?p=555"},"modified":"2012-07-10T10:59:28","modified_gmt":"2012-07-10T02:59:28","slug":"forcing-http-traffic-over-https-using-apache","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=555","title":{"rendered":"Forcing HTTP traffic over HTTPS using Apache"},"content":{"rendered":"<h2>Forcing HTTP traffic over HTTPS using Apache<\/h2>\n<p>I recently was required to redirect all traffic for a domain over an HTTPS connection. Using the Apache\u2019s .htaccess files and the RewriteEngine, this task is trivial.<\/p>\n<p>Insert this block of code into your .htaccess file at the root of your domain. This will redirect at HTTP traffic to use an HTTPS connection instead:<\/p>\n<div>\n<div id=\"highlighter_582724\">\n<div><\/div>\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<div>\n<div><code>RewriteEngine On<\/code><\/div>\n<div><code>RewriteCond %{HTTPS} off<\/code><\/div>\n<div><code>RewriteRule (.*) <a href=\"https:\/\/%\/\">https:\/\/%<\/a>{HTTP_HOST}%{REQUEST_URI}<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>You also need to make sure you have this line in your httpd.conf file (installed by default on most Linux Distributions)<\/p>\n<div>\n<div><code>LoadModule rewrite_module modules\/mod_rewrite.so<\/code><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Forcing HTTP traffic over HTTPS using Apache <\/p>\n<p>I recently was required to redirect all traffic for a domain over an HTTPS connection. Using the Apache\u2019s .htaccess files and the RewriteEngine, this task is trivial.<\/p>\n<p>Insert this block of code into your .htaccess file at the root of your domain. This will redirect at HTTP traffic [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/555"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=555"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/555\/revisions"}],"predecessor-version":[{"id":556,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/555\/revisions\/556"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=555"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=555"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=555"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}