{"id":6416,"date":"2020-07-07T07:11:42","date_gmt":"2020-07-07T07:11:42","guid":{"rendered":"https:\/\/www.bodhost.com\/kb\/?p=6416"},"modified":"2026-02-26T14:03:10","modified_gmt":"2026-02-26T14:03:10","slug":"how-to-redirect-a-website-from-http-to-https","status":"publish","type":"post","link":"https:\/\/www.bodhost.com\/kb\/how-to-redirect-a-website-from-http-to-https\/","title":{"rendered":"How to Redirect a Website from http to https?"},"content":{"rendered":"\r\n<p>You can follow any of the three methods mentioned below for redirecting your website from HTTP to HTTPS-<\/p>\r\n\r\n\r\n\r\n<p><strong>Method 1: Using a .htaccess file<\/strong><\/p>\r\n\r\n\r\n\r\n<p>You can use the following code and edit the .htaccessfile for moving from HTTP to HTTPS-<\/p>\r\n\r\n\r\n\r\n<p>RewriteEngine On<\/p>\r\n\r\n\r\n\r\n<p>RewriteCond %{HTTPS} off<\/p>\r\n\r\n\r\n\r\n<p>RewriteRule (.*)\u00a0https:\/\/%{HTTP_HOST}%{REQUEST_URI}<\/p>\r\n\r\n\r\n\r\n<p>Usually, the websites often use an HTTP protocol as the default protocol for handling all the critical information. Still, with https, you get various security and other benefits for your website.<\/p>\r\n\r\n\r\n\r\n<p><strong>Method 2: Using a PHP function<\/strong><\/p>\r\n\r\n\r\n\r\n<p>You can also use the following .php function for redirecting your website. You just need to call the function in the right place from where you wish to get the redirection.<\/p>\r\n\r\n\r\n\r\n<p>&lt;\u00a0?php<\/p>\r\n\r\n\r\n\r\n<p>function\u00a0redirectTohttps() {<\/p>\r\n\r\n\r\n\r\n<p>if($_SERVER[\u2018HTTPS\u2019]!=\u201don\u201d) {<\/p>\r\n\r\n\r\n\r\n<p>$redirect= \u201chttps:\/\/\u201d.$_SERVER[\u2018HTTP_HOST\u2019].$_SERVER[\u2018REQUEST_URI\u2019];<\/p>\r\n\r\n\r\n\r\n<p>header(\u201cLocation:$redirect\u201d);\u00a0}\u00a0}<\/p>\r\n\r\n\r\n\r\n<p>?&gt;<\/p>\r\n\r\n\r\n\r\n<p><strong>Method 3: Using an HTML Meta Tag<\/strong><\/p>\r\n\r\n\r\n\r\n<p>The methods discussed above are sufficient enough for making a move to HTTP from HTTPS. Using an HTML Tag might not be that effective as compared to the previous two. Still, you can use it if you fail to use the \u201cmod rewrite.\u201d<\/p>\r\n\r\n\r\n\r\n<p>Make sure to add the following to your web page header-<\/p>\r\n\r\n\r\n\r\n<p>&lt;\u00a0meta\u00a0http-equiv=\u201dRefresh\u201d content=\u201d0;URL=https:\/\/www.yourdomainname.com\u201d \/&gt;<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>You can follow any of the three methods mentioned below for redirecting your website from HTTP to HTTPS- Method 1: Using a .htaccess file You can use the following code&hellip;<\/p>\n<p><a href=\"https:\/\/www.bodhost.com\/kb\/how-to-redirect-a-website-from-http-to-https\/\" class=\"more-link\">Read More<\/a><\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[837],"tags":[843,840,380],"class_list":["post-6416","post","type-post","status-publish","format-standard","hentry","category-tutorial","tag-http-to-https-htaccess","tag-redirect-a-website-from-http-to-https","tag-website"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Redirect a Website from http to https? bodHOST<\/title>\n<meta name=\"description\" content=\"Having an HTTPS extension in the website URL ensures enhanced security of the data hosted.. So, how can a user redirect his website to https?\" \/>\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.bodhost.com\/kb\/how-to-redirect-a-website-from-http-to-https\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Redirect a Website from http to https? bodHOST\" \/>\n<meta property=\"og:description\" content=\"Having an HTTPS extension in the website URL ensures enhanced security of the data hosted.. So, how can a user redirect his website to https?\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.bodhost.com\/kb\/how-to-redirect-a-website-from-http-to-https\/\" \/>\n<meta property=\"og:site_name\" content=\"Knowledge Base - bodHOST\" \/>\n<meta property=\"article:published_time\" content=\"2020-07-07T07:11:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-02-26T14:03:10+00:00\" \/>\n<meta name=\"author\" content=\"Paul Lopez\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Paul Lopez\" \/>\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:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-redirect-a-website-from-http-to-https\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-redirect-a-website-from-http-to-https\\\/\"},\"author\":{\"name\":\"Paul Lopez\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/566ccff9a2fae4af852be8097b179813\"},\"headline\":\"How to Redirect a Website from http to https?\",\"datePublished\":\"2020-07-07T07:11:42+00:00\",\"dateModified\":\"2026-02-26T14:03:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-redirect-a-website-from-http-to-https\\\/\"},\"wordCount\":217,\"publisher\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\"},\"keywords\":[\"http to https htaccess\",\"Redirect a Website from http to https\",\"Website\"],\"articleSection\":[\"Tutorial\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-redirect-a-website-from-http-to-https\\\/\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-redirect-a-website-from-http-to-https\\\/\",\"name\":\"How to Redirect a Website from http to https? bodHOST\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#website\"},\"datePublished\":\"2020-07-07T07:11:42+00:00\",\"dateModified\":\"2026-02-26T14:03:10+00:00\",\"description\":\"Having an HTTPS extension in the website URL ensures enhanced security of the data hosted.. So, how can a user redirect his website to https?\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-redirect-a-website-from-http-to-https\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-redirect-a-website-from-http-to-https\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-redirect-a-website-from-http-to-https\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Tutorial\",\"item\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/category\\\/tutorial\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Redirect a Website from http to https?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#website\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/\",\"name\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\"},\"alternateName\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\",\"name\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/wp-content\\\/uploads\\\/2025\\\/10\\\/Profile-Pic.png\",\"contentUrl\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/wp-content\\\/uploads\\\/2025\\\/10\\\/Profile-Pic.png\",\"width\":240,\"height\":240,\"caption\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\"},\"image\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/566ccff9a2fae4af852be8097b179813\",\"name\":\"Paul Lopez\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c63d9f5400cd5ef87b481a24b2c1a4fb89f1674b6391325326cf13f1e735dff8?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c63d9f5400cd5ef87b481a24b2c1a4fb89f1674b6391325326cf13f1e735dff8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c63d9f5400cd5ef87b481a24b2c1a4fb89f1674b6391325326cf13f1e735dff8?s=96&d=mm&r=g\",\"caption\":\"Paul Lopez\"},\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/author\\\/paullopez\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Redirect a Website from http to https? bodHOST","description":"Having an HTTPS extension in the website URL ensures enhanced security of the data hosted.. So, how can a user redirect his website to https?","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.bodhost.com\/kb\/how-to-redirect-a-website-from-http-to-https\/","og_locale":"en_US","og_type":"article","og_title":"How to Redirect a Website from http to https? bodHOST","og_description":"Having an HTTPS extension in the website URL ensures enhanced security of the data hosted.. So, how can a user redirect his website to https?","og_url":"https:\/\/www.bodhost.com\/kb\/how-to-redirect-a-website-from-http-to-https\/","og_site_name":"Knowledge Base - bodHOST","article_published_time":"2020-07-07T07:11:42+00:00","article_modified_time":"2026-02-26T14:03:10+00:00","author":"Paul Lopez","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Paul Lopez","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.bodhost.com\/kb\/how-to-redirect-a-website-from-http-to-https\/#article","isPartOf":{"@id":"https:\/\/www.bodhost.com\/kb\/how-to-redirect-a-website-from-http-to-https\/"},"author":{"name":"Paul Lopez","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/person\/566ccff9a2fae4af852be8097b179813"},"headline":"How to Redirect a Website from http to https?","datePublished":"2020-07-07T07:11:42+00:00","dateModified":"2026-02-26T14:03:10+00:00","mainEntityOfPage":{"@id":"https:\/\/www.bodhost.com\/kb\/how-to-redirect-a-website-from-http-to-https\/"},"wordCount":217,"publisher":{"@id":"https:\/\/www.bodhost.com\/kb\/#organization"},"keywords":["http to https htaccess","Redirect a Website from http to https","Website"],"articleSection":["Tutorial"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.bodhost.com\/kb\/how-to-redirect-a-website-from-http-to-https\/","url":"https:\/\/www.bodhost.com\/kb\/how-to-redirect-a-website-from-http-to-https\/","name":"How to Redirect a Website from http to https? bodHOST","isPartOf":{"@id":"https:\/\/www.bodhost.com\/kb\/#website"},"datePublished":"2020-07-07T07:11:42+00:00","dateModified":"2026-02-26T14:03:10+00:00","description":"Having an HTTPS extension in the website URL ensures enhanced security of the data hosted.. So, how can a user redirect his website to https?","breadcrumb":{"@id":"https:\/\/www.bodhost.com\/kb\/how-to-redirect-a-website-from-http-to-https\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.bodhost.com\/kb\/how-to-redirect-a-website-from-http-to-https\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.bodhost.com\/kb\/how-to-redirect-a-website-from-http-to-https\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Tutorial","item":"https:\/\/www.bodhost.com\/kb\/category\/tutorial\/"},{"@type":"ListItem","position":2,"name":"How to Redirect a Website from http to https?"}]},{"@type":"WebSite","@id":"https:\/\/www.bodhost.com\/kb\/#website","url":"https:\/\/www.bodhost.com\/kb\/","name":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","description":"","publisher":{"@id":"https:\/\/www.bodhost.com\/kb\/#organization"},"alternateName":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.bodhost.com\/kb\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.bodhost.com\/kb\/#organization","name":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","url":"https:\/\/www.bodhost.com\/kb\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/logo\/image\/","url":"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2025\/10\/Profile-Pic.png","contentUrl":"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2025\/10\/Profile-Pic.png","width":240,"height":240,"caption":"Web Hosting Knowledge Base | bodHOST Hosting FAQ"},"image":{"@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/person\/566ccff9a2fae4af852be8097b179813","name":"Paul Lopez","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c63d9f5400cd5ef87b481a24b2c1a4fb89f1674b6391325326cf13f1e735dff8?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c63d9f5400cd5ef87b481a24b2c1a4fb89f1674b6391325326cf13f1e735dff8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c63d9f5400cd5ef87b481a24b2c1a4fb89f1674b6391325326cf13f1e735dff8?s=96&d=mm&r=g","caption":"Paul Lopez"},"url":"https:\/\/www.bodhost.com\/kb\/author\/paullopez\/"}]}},"_links":{"self":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/6416","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/comments?post=6416"}],"version-history":[{"count":3,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/6416\/revisions"}],"predecessor-version":[{"id":12014,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/6416\/revisions\/12014"}],"wp:attachment":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/media?parent=6416"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/categories?post=6416"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/tags?post=6416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}