{"id":132,"date":"2017-04-23T03:44:09","date_gmt":"2017-04-23T03:44:09","guid":{"rendered":"https:\/\/shujaahost.co.ke\/blog\/?p=132"},"modified":"2017-04-23T03:47:42","modified_gmt":"2017-04-23T03:47:42","slug":"how-to-force-https-using-the-htaccess-file","status":"publish","type":"post","link":"https:\/\/shujaahost.co.ke\/blog\/how-to-force-https-using-the-htaccess-file\/","title":{"rendered":"How to force HTTPS using the .htaccess file"},"content":{"rendered":"<p><span style=\"color: #232323; font-family: Helvetica; font-size: 12pt;\"><strong>Hypertext Transfer Protocol Secure (HTTPS) <\/strong>is the secure version of <strong>HTTP (Hypertext Transfer Protocol).<br \/>\n<\/strong><\/span><\/p>\n<p><span style=\"color: #232323; font-family: Helvetica; font-size: 12pt;\"><strong>HTTP <\/strong>is the protocol over which data is sent between a browser and a website or a web application. The &#8220;S&#8221; in <strong>HTTPS <\/strong>stands for <strong>SECURE. HTTPS <\/strong>encrypts all communications between a browser and a website.<br \/>\n<\/span><\/p>\n<p><span style=\"color: #232323; font-family: Helvetica; font-size: 12pt;\">Sometimes it&#8217;s necessary to make sure your website&#8217;s visitors use the SSL encrypted connection.<br \/>\n<\/span><\/p>\n<p><span style=\"color: #232323; font-family: Helvetica; font-size: 12pt;\">To force\u00a0all your website visitors\u00a0to use HTTPS insert\u00a0the following lines of code in the .htaccess file in your website&#8217;s root folder.<br \/>\n<\/span><\/p>\n<p style=\"background: #c5e0b3;\"><span style=\"color: black; font-family: Courier New; font-size: 12pt;\"><strong>RewriteEngine On<br \/>\n<\/strong><\/span><\/p>\n<p style=\"background: #c5e0b3;\"><span style=\"color: black; font-family: Courier New; font-size: 12pt;\"><strong>RewriteCond %{SERVER_PORT} 80<br \/>\n<\/strong><\/span><\/p>\n<p style=\"background: #c5e0b3;\"><span style=\"color: black; font-family: Courier New; font-size: 12pt;\"><strong>RewriteRule ^(.*)$ https:\/\/www.yoursite.com\/$1 [R,L]<br \/>\n<\/strong><\/span><\/p>\n<p><span style=\"color: #232323; font-family: Helvetica; font-size: 14pt;\"><span style=\"background-color: #f9f9f9;\">Be sure to replace\u00a0<strong>www.<\/strong><\/span><span style=\"color: black;\"><strong>yoursite<span style=\"color: #232323; background-color: #f9f9f9;\">.com<\/span><\/strong>\u00a0<span style=\"color: #232323; background-color: #f9f9f9;\">with your actual domain name.<br \/>\n<\/span><\/span><\/span><\/p>\n<p><span style=\"color: #232323; font-family: Helvetica; font-size: 14pt;\">To force a\u00a0<em>specific domain<\/em>\u00a0to use HTTPS, use the following lines of code in the .htaccess file in your website&#8217;s root folder:<br \/>\n<\/span><\/p>\n<p style=\"background: #c5e0b3;\"><span style=\"color: black; font-family: Courier New;\"><strong>RewriteEngine On<br \/>\n<\/strong><\/span><\/p>\n<p style=\"background: #c5e0b3;\"><span style=\"color: black; font-family: Courier New;\"><strong>RewriteCond %{HTTP_HOST} ^yoursite\\.com [NC]<br \/>\n<\/strong><\/span><\/p>\n<p style=\"background: #c5e0b3;\"><span style=\"color: black; font-family: Courier New;\"><strong>RewriteCond %{SERVER_PORT} 80<br \/>\n<\/strong><\/span><\/p>\n<p style=\"background: #c5e0b3;\"><span style=\"color: black; font-family: Courier New;\"><strong>RewriteRule ^(.*)$ https:\/\/www.yoursite.com\/$1 [R,L]<br \/>\n<\/strong><\/span><\/p>\n<p><span style=\"color: #232323; font-family: Helvetica; font-size: 14pt;\">Make sure to replace\u00a0<strong>yoursite.com<\/strong>\u00a0with the domain name you&#8217;re trying force to https. Additionally, you need to replace\u00a0<strong>www.example.com<\/strong>\u00a0with your actual domain name.<br \/>\n<\/span><\/p>\n<p><span style=\"color: #232323; font-family: Helvetica; font-size: 14pt;\">If you want to force SSL on a specific folder you can insert the code below into a .htaccess file placed in that specific folder:<br \/>\n<\/span><\/p>\n<p style=\"background: #c5e0b3;\"><span style=\"color: black; font-family: Courier New;\"><strong>RewriteEngine On<br \/>\n<\/strong><\/span><\/p>\n<p style=\"background: #c5e0b3;\"><span style=\"color: black; font-family: Courier New;\"><strong>RewriteCond %{SERVER_PORT} 80<br \/>\n<\/strong><\/span><\/p>\n<p style=\"background: #c5e0b3;\"><span style=\"color: black; font-family: Courier New;\"><strong>RewriteCond %{REQUEST_URI} folder<br \/>\n<\/strong><\/span><\/p>\n<p style=\"background: #c5e0b3;\"><span style=\"color: black; font-family: Courier New;\"><strong>RewriteRule ^(.*)$ https:\/\/www.yoursite.com\/folder\/$1 [R,L]<br \/>\n<\/strong><\/span><\/p>\n<p><span style=\"color: #232323; font-family: Helvetica; font-size: 14pt;\">Make sure you change the\u00a0<em>folder<\/em>\u00a0reference to the actual folder name. Then be sure to replace\u00a0<em>www.yoursite.com\/folder\u00a0<\/em>with your actual domain name and folder you want to force the SSL on.<br \/>\n<\/span><\/p>\n<p><span style=\"color: #232323; font-family: Helvetica; font-size: 18pt;\"><br \/>\n<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hypertext Transfer Protocol Secure (HTTPS) is the secure version of HTTP (Hypertext Transfer Protocol). HTTP is the protocol over which data is sent between a browser and a website or a web application. The &#8220;S&#8221; in HTTPS stands for SECURE. HTTPS encrypts all communications between a browser and a website. Sometimes it&#8217;s necessary to make ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/shujaahost.co.ke\/blog\/how-to-force-https-using-the-htaccess-file\/\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-132","post","type-post","status-publish","format-standard","hentry","category-ssl-certificates"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to force HTTPS using the .htaccess file - Shujaa Host<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/shujaahost.co.ke\/blog\/how-to-force-https-using-the-htaccess-file\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to force HTTPS using the .htaccess file - Shujaa Host\" \/>\n<meta property=\"og:description\" content=\"Hypertext Transfer Protocol Secure (HTTPS) is the secure version of HTTP (Hypertext Transfer Protocol). HTTP is the protocol over which data is sent between a browser and a website or a web application. The &#8220;S&#8221; in HTTPS stands for SECURE. HTTPS encrypts all communications between a browser and a website. Sometimes it&#8217;s necessary to make ..Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/shujaahost.co.ke\/blog\/how-to-force-https-using-the-htaccess-file\/\" \/>\n<meta property=\"og:site_name\" content=\"Shujaa Host\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/shujaahostKenya\/\" \/>\n<meta property=\"article:published_time\" content=\"2017-04-23T03:44:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-04-23T03:47:42+00:00\" \/>\n<meta name=\"author\" content=\"Mike\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@shujaahost_ke\" \/>\n<meta name=\"twitter:site\" content=\"@shujaahost_ke\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mike\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/shujaahost.co.ke\/blog\/how-to-force-https-using-the-htaccess-file\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/shujaahost.co.ke\/blog\/how-to-force-https-using-the-htaccess-file\/\"},\"author\":{\"name\":\"Mike\",\"@id\":\"https:\/\/shujaahost.co.ke\/blog\/#\/schema\/person\/663b69c8fe6b606af1e68eee6f46249f\"},\"headline\":\"How to force HTTPS using the .htaccess file\",\"datePublished\":\"2017-04-23T03:44:09+00:00\",\"dateModified\":\"2017-04-23T03:47:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/shujaahost.co.ke\/blog\/how-to-force-https-using-the-htaccess-file\/\"},\"wordCount\":266,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/shujaahost.co.ke\/blog\/#organization\"},\"articleSection\":[\"SSL Certificates\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/shujaahost.co.ke\/blog\/how-to-force-https-using-the-htaccess-file\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/shujaahost.co.ke\/blog\/how-to-force-https-using-the-htaccess-file\/\",\"url\":\"https:\/\/shujaahost.co.ke\/blog\/how-to-force-https-using-the-htaccess-file\/\",\"name\":\"How to force HTTPS using the .htaccess file - Shujaa Host\",\"isPartOf\":{\"@id\":\"https:\/\/shujaahost.co.ke\/blog\/#website\"},\"datePublished\":\"2017-04-23T03:44:09+00:00\",\"dateModified\":\"2017-04-23T03:47:42+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/shujaahost.co.ke\/blog\/how-to-force-https-using-the-htaccess-file\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/shujaahost.co.ke\/blog\/how-to-force-https-using-the-htaccess-file\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/shujaahost.co.ke\/blog\/how-to-force-https-using-the-htaccess-file\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/shujaahost.co.ke\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to force HTTPS using the .htaccess file\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/shujaahost.co.ke\/blog\/#website\",\"url\":\"https:\/\/shujaahost.co.ke\/blog\/\",\"name\":\"Shujaa Host\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/shujaahost.co.ke\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/shujaahost.co.ke\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/shujaahost.co.ke\/blog\/#organization\",\"name\":\"Shujaa Host\",\"url\":\"https:\/\/shujaahost.co.ke\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/shujaahost.co.ke\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/shujaahost.co.ke\/blog\/wp-content\/uploads\/2018\/10\/new-logo3-e1550211460915.png\",\"contentUrl\":\"https:\/\/shujaahost.co.ke\/blog\/wp-content\/uploads\/2018\/10\/new-logo3-e1550211460915.png\",\"width\":911,\"height\":770,\"caption\":\"Shujaa Host\"},\"image\":{\"@id\":\"https:\/\/shujaahost.co.ke\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/shujaahostKenya\/\",\"https:\/\/x.com\/shujaahost_ke\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/shujaahost.co.ke\/blog\/#\/schema\/person\/663b69c8fe6b606af1e68eee6f46249f\",\"name\":\"Mike\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/shujaahost.co.ke\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/179418316e42215939b8f01eb824243c?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/179418316e42215939b8f01eb824243c?s=96&r=g\",\"caption\":\"Mike\"},\"url\":\"https:\/\/shujaahost.co.ke\/blog\/author\/mike\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to force HTTPS using the .htaccess file - Shujaa Host","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/shujaahost.co.ke\/blog\/how-to-force-https-using-the-htaccess-file\/","og_locale":"en_US","og_type":"article","og_title":"How to force HTTPS using the .htaccess file - Shujaa Host","og_description":"Hypertext Transfer Protocol Secure (HTTPS) is the secure version of HTTP (Hypertext Transfer Protocol). HTTP is the protocol over which data is sent between a browser and a website or a web application. The &#8220;S&#8221; in HTTPS stands for SECURE. HTTPS encrypts all communications between a browser and a website. Sometimes it&#8217;s necessary to make ..Read more","og_url":"https:\/\/shujaahost.co.ke\/blog\/how-to-force-https-using-the-htaccess-file\/","og_site_name":"Shujaa Host","article_publisher":"https:\/\/www.facebook.com\/shujaahostKenya\/","article_published_time":"2017-04-23T03:44:09+00:00","article_modified_time":"2017-04-23T03:47:42+00:00","author":"Mike","twitter_card":"summary_large_image","twitter_creator":"@shujaahost_ke","twitter_site":"@shujaahost_ke","twitter_misc":{"Written by":"Mike","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/shujaahost.co.ke\/blog\/how-to-force-https-using-the-htaccess-file\/#article","isPartOf":{"@id":"https:\/\/shujaahost.co.ke\/blog\/how-to-force-https-using-the-htaccess-file\/"},"author":{"name":"Mike","@id":"https:\/\/shujaahost.co.ke\/blog\/#\/schema\/person\/663b69c8fe6b606af1e68eee6f46249f"},"headline":"How to force HTTPS using the .htaccess file","datePublished":"2017-04-23T03:44:09+00:00","dateModified":"2017-04-23T03:47:42+00:00","mainEntityOfPage":{"@id":"https:\/\/shujaahost.co.ke\/blog\/how-to-force-https-using-the-htaccess-file\/"},"wordCount":266,"commentCount":2,"publisher":{"@id":"https:\/\/shujaahost.co.ke\/blog\/#organization"},"articleSection":["SSL Certificates"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/shujaahost.co.ke\/blog\/how-to-force-https-using-the-htaccess-file\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/shujaahost.co.ke\/blog\/how-to-force-https-using-the-htaccess-file\/","url":"https:\/\/shujaahost.co.ke\/blog\/how-to-force-https-using-the-htaccess-file\/","name":"How to force HTTPS using the .htaccess file - Shujaa Host","isPartOf":{"@id":"https:\/\/shujaahost.co.ke\/blog\/#website"},"datePublished":"2017-04-23T03:44:09+00:00","dateModified":"2017-04-23T03:47:42+00:00","breadcrumb":{"@id":"https:\/\/shujaahost.co.ke\/blog\/how-to-force-https-using-the-htaccess-file\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/shujaahost.co.ke\/blog\/how-to-force-https-using-the-htaccess-file\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/shujaahost.co.ke\/blog\/how-to-force-https-using-the-htaccess-file\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/shujaahost.co.ke\/blog\/"},{"@type":"ListItem","position":2,"name":"How to force HTTPS using the .htaccess file"}]},{"@type":"WebSite","@id":"https:\/\/shujaahost.co.ke\/blog\/#website","url":"https:\/\/shujaahost.co.ke\/blog\/","name":"Shujaa Host","description":"","publisher":{"@id":"https:\/\/shujaahost.co.ke\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/shujaahost.co.ke\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/shujaahost.co.ke\/blog\/#organization","name":"Shujaa Host","url":"https:\/\/shujaahost.co.ke\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/shujaahost.co.ke\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/shujaahost.co.ke\/blog\/wp-content\/uploads\/2018\/10\/new-logo3-e1550211460915.png","contentUrl":"https:\/\/shujaahost.co.ke\/blog\/wp-content\/uploads\/2018\/10\/new-logo3-e1550211460915.png","width":911,"height":770,"caption":"Shujaa Host"},"image":{"@id":"https:\/\/shujaahost.co.ke\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/shujaahostKenya\/","https:\/\/x.com\/shujaahost_ke"]},{"@type":"Person","@id":"https:\/\/shujaahost.co.ke\/blog\/#\/schema\/person\/663b69c8fe6b606af1e68eee6f46249f","name":"Mike","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/shujaahost.co.ke\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/179418316e42215939b8f01eb824243c?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/179418316e42215939b8f01eb824243c?s=96&r=g","caption":"Mike"},"url":"https:\/\/shujaahost.co.ke\/blog\/author\/mike\/"}]}},"_links":{"self":[{"href":"https:\/\/shujaahost.co.ke\/blog\/wp-json\/wp\/v2\/posts\/132","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shujaahost.co.ke\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shujaahost.co.ke\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/shujaahost.co.ke\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/shujaahost.co.ke\/blog\/wp-json\/wp\/v2\/comments?post=132"}],"version-history":[{"count":2,"href":"https:\/\/shujaahost.co.ke\/blog\/wp-json\/wp\/v2\/posts\/132\/revisions"}],"predecessor-version":[{"id":134,"href":"https:\/\/shujaahost.co.ke\/blog\/wp-json\/wp\/v2\/posts\/132\/revisions\/134"}],"wp:attachment":[{"href":"https:\/\/shujaahost.co.ke\/blog\/wp-json\/wp\/v2\/media?parent=132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shujaahost.co.ke\/blog\/wp-json\/wp\/v2\/categories?post=132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shujaahost.co.ke\/blog\/wp-json\/wp\/v2\/tags?post=132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}