{"id":71,"date":"2018-12-14T06:00:03","date_gmt":"2018-12-14T06:00:03","guid":{"rendered":"https:\/\/www.peppypage.com\/blog\/?p=71"},"modified":"2018-12-30T06:25:28","modified_gmt":"2018-12-30T06:25:28","slug":"redirect-http-to-https-using-htaccess-file","status":"publish","type":"post","link":"https:\/\/www.peppypage.com\/content\/redirect-http-to-https-using-htaccess-file\/","title":{"rendered":"Redirect http to https using .htaccess file"},"content":{"rendered":"\n<p>Sometimes it becomes hard to change all existing website urls or links to use https. And as of 2018 September chrome shows insecure warning if website not using SSL or serving pages over http. SSL is freely available with most of top hosting providers. If not one can get free certificate from Startcom SSL or Letsencrypt. In this post we will explain you a way to add small rule to redirect http to https using .htaccess file.&nbsp;<\/p>\n\n\n\n<h2>.htaccess File<\/h2>\n\n\n\n<p>To find or locate your htaccess file login to file manager using FTP or cPanel\/Plesk File manager (if you are using any one of them). From root of your domain\/website usually public_html in cpanel, httpdocs in plesk. For others it varies, on ubuntu or linux\/unix operating system you can find the .htaccess file under \/var\/www\/html).<\/p>\n\n\n\n<h3><strong>Note:<\/strong> <\/h3>\n\n\n\n<p>If you are using cPanel, make sure to check show hidden files(dotfiles) using gear icon Settings link near top right of cPanel file manager.<\/p>\n\n\n\n<p>On linux\/unix apache2 domain root, to view dot files (which are usually treated as system files) press Ctrl+H<\/p>\n\n\n\n<h2>Rules to Redirect http requests to https<\/h2>\n\n\n\n<p>Once you locate the .htaccess file, edit it using your favourite editor. Add the following code to your htaccess file<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RewriteEngine On #do not add this line if its already present in your htaccess file\nRewriteCond %{HTTPS} !on\nRewriteRule ^(.*)$ https:\/\/%{HTTP_HOST}%{REQUEST_URI) [L,R=301]<\/code><\/pre>\n\n\n\n<p>thats all once you added the above code to your htaccess file it starts sending all non https requests to https.<\/p>\n\n\n\n<h2>Rules to Redirect Particular Domain to https<\/h2>\n\n\n\n<p>Use the following code to redirect particular domain to https<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RewriteEngine On #do not add this line if its already present in your htaccess file\nRewriteCond %{HTTPS} !on\nRewriteCond %{HTTP_HOST} ^(www\\.)yourdomain\\.tld [NC]\nRewriteRule ^(.*)$ https:\/\/%{HTTP_HOST}%{REQUEST_URI) [L,R=301]<\/code><\/pre>\n\n\n\n<p>Do not forget to change the domain (yourdomain\\.tld to your domain name which you want to redirect to https) <\/p>\n\n\n\n<p>If you are looking for more set of .htaccess rules add comment.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes it becomes hard to change all existing website urls or links to use https. And as of 2018 September [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":85,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v19.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Redirect http to https using .htaccess file - Domain, Web Hosting and Cloud Hosting Trends<\/title>\n<meta name=\"description\" content=\"Redirect http to https using .htaccess, using a small line in your .htaccess file redirect all http links to https. Quick an easy fix..\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.peppypage.com\/content\/redirect-http-to-https-using-htaccess-file\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Redirect http to https using .htaccess file - Domain, Web Hosting and Cloud Hosting Trends\" \/>\n<meta property=\"og:description\" content=\"Redirect http to https using .htaccess, using a small line in your .htaccess file redirect all http links to https. Quick an easy fix..\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.peppypage.com\/content\/redirect-http-to-https-using-htaccess-file\/\" \/>\n<meta property=\"og:site_name\" content=\"Domain, Web Hosting and Cloud Hosting Trends\" \/>\n<meta property=\"article:published_time\" content=\"2018-12-14T06:00:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-12-30T06:25:28+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.peppypage.com\/content\/wp-content\/uploads\/2018\/12\/template-1599665.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1280\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"bharathsde\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"bharathsde\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.peppypage.com\/content\/#website\",\"url\":\"https:\/\/www.peppypage.com\/content\/\",\"name\":\"Domain, Web Hosting and Cloud Hosting Trends\",\"description\":\"Learn how to secure your app and website\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.peppypage.com\/content\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.peppypage.com\/content\/redirect-http-to-https-using-htaccess-file\/\",\"url\":\"https:\/\/www.peppypage.com\/content\/redirect-http-to-https-using-htaccess-file\/\",\"name\":\"Redirect http to https using .htaccess file - Domain, Web Hosting and Cloud Hosting Trends\",\"isPartOf\":{\"@id\":\"https:\/\/www.peppypage.com\/content\/#website\"},\"datePublished\":\"2018-12-14T06:00:03+00:00\",\"dateModified\":\"2018-12-30T06:25:28+00:00\",\"author\":{\"@id\":\"https:\/\/www.peppypage.com\/content\/#\/schema\/person\/33a613ea798a2b94d8ec79faa0f76403\"},\"description\":\"Redirect http to https using .htaccess, using a small line in your .htaccess file redirect all http links to https. Quick an easy fix..\",\"breadcrumb\":{\"@id\":\"https:\/\/www.peppypage.com\/content\/redirect-http-to-https-using-htaccess-file\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.peppypage.com\/content\/redirect-http-to-https-using-htaccess-file\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.peppypage.com\/content\/redirect-http-to-https-using-htaccess-file\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.peppypage.com\/content\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Redirect http to https using .htaccess file\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.peppypage.com\/content\/#\/schema\/person\/33a613ea798a2b94d8ec79faa0f76403\",\"name\":\"bharathsde\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.peppypage.com\/content\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6d56691d057a81ea8a03b12c51675abb?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6d56691d057a81ea8a03b12c51675abb?s=96&d=mm&r=g\",\"caption\":\"bharathsde\"},\"url\":\"https:\/\/www.peppypage.com\/content\/author\/bharathsde\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Redirect http to https using .htaccess file - Domain, Web Hosting and Cloud Hosting Trends","description":"Redirect http to https using .htaccess, using a small line in your .htaccess file redirect all http links to https. Quick an easy fix..","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:\/\/www.peppypage.com\/content\/redirect-http-to-https-using-htaccess-file\/","og_locale":"en_US","og_type":"article","og_title":"Redirect http to https using .htaccess file - Domain, Web Hosting and Cloud Hosting Trends","og_description":"Redirect http to https using .htaccess, using a small line in your .htaccess file redirect all http links to https. Quick an easy fix..","og_url":"https:\/\/www.peppypage.com\/content\/redirect-http-to-https-using-htaccess-file\/","og_site_name":"Domain, Web Hosting and Cloud Hosting Trends","article_published_time":"2018-12-14T06:00:03+00:00","article_modified_time":"2018-12-30T06:25:28+00:00","og_image":[{"width":1920,"height":1280,"url":"https:\/\/www.peppypage.com\/content\/wp-content\/uploads\/2018\/12\/template-1599665.png","type":"image\/png"}],"author":"bharathsde","twitter_card":"summary_large_image","twitter_misc":{"Written by":"bharathsde","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/www.peppypage.com\/content\/#website","url":"https:\/\/www.peppypage.com\/content\/","name":"Domain, Web Hosting and Cloud Hosting Trends","description":"Learn how to secure your app and website","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.peppypage.com\/content\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.peppypage.com\/content\/redirect-http-to-https-using-htaccess-file\/","url":"https:\/\/www.peppypage.com\/content\/redirect-http-to-https-using-htaccess-file\/","name":"Redirect http to https using .htaccess file - Domain, Web Hosting and Cloud Hosting Trends","isPartOf":{"@id":"https:\/\/www.peppypage.com\/content\/#website"},"datePublished":"2018-12-14T06:00:03+00:00","dateModified":"2018-12-30T06:25:28+00:00","author":{"@id":"https:\/\/www.peppypage.com\/content\/#\/schema\/person\/33a613ea798a2b94d8ec79faa0f76403"},"description":"Redirect http to https using .htaccess, using a small line in your .htaccess file redirect all http links to https. Quick an easy fix..","breadcrumb":{"@id":"https:\/\/www.peppypage.com\/content\/redirect-http-to-https-using-htaccess-file\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.peppypage.com\/content\/redirect-http-to-https-using-htaccess-file\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.peppypage.com\/content\/redirect-http-to-https-using-htaccess-file\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.peppypage.com\/content\/"},{"@type":"ListItem","position":2,"name":"Redirect http to https using .htaccess file"}]},{"@type":"Person","@id":"https:\/\/www.peppypage.com\/content\/#\/schema\/person\/33a613ea798a2b94d8ec79faa0f76403","name":"bharathsde","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.peppypage.com\/content\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6d56691d057a81ea8a03b12c51675abb?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6d56691d057a81ea8a03b12c51675abb?s=96&d=mm&r=g","caption":"bharathsde"},"url":"https:\/\/www.peppypage.com\/content\/author\/bharathsde\/"}]}},"_links":{"self":[{"href":"https:\/\/www.peppypage.com\/content\/wp-json\/wp\/v2\/posts\/71"}],"collection":[{"href":"https:\/\/www.peppypage.com\/content\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.peppypage.com\/content\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.peppypage.com\/content\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.peppypage.com\/content\/wp-json\/wp\/v2\/comments?post=71"}],"version-history":[{"count":8,"href":"https:\/\/www.peppypage.com\/content\/wp-json\/wp\/v2\/posts\/71\/revisions"}],"predecessor-version":[{"id":122,"href":"https:\/\/www.peppypage.com\/content\/wp-json\/wp\/v2\/posts\/71\/revisions\/122"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.peppypage.com\/content\/wp-json\/wp\/v2\/media\/85"}],"wp:attachment":[{"href":"https:\/\/www.peppypage.com\/content\/wp-json\/wp\/v2\/media?parent=71"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.peppypage.com\/content\/wp-json\/wp\/v2\/categories?post=71"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.peppypage.com\/content\/wp-json\/wp\/v2\/tags?post=71"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}