{"id":1681,"date":"2021-09-06T09:59:47","date_gmt":"2021-09-06T09:59:47","guid":{"rendered":"https:\/\/ownwebservers.com\/kb\/?p=1681"},"modified":"2021-09-06T10:01:34","modified_gmt":"2021-09-06T10:01:34","slug":"1681","status":"publish","type":"post","link":"https:\/\/ownwebservers.com\/kb\/1681\/","title":{"rendered":"3 Simple Ways To Redirect a Website From Http to Https"},"content":{"rendered":"<p>The major part in hosting an web site on-line is to look for its security as a result nowadays malicious activities have increased from 45% on the servers with no security protocols. SSL is a decent choice over it, however beware of open source SSL that is free, but at constant time not secure to shield a web site. The Hypertext Transfer Protocol (HTTP) is an application protocol that is used for distributed, collaborative, multimedia data systems. The \u201cS\u201d in https indicated as \u201cSecure Socket Layer\u201d (SSL).<\/p>\n<p>Why SSL? Why do i required SSL? what&#8217;s going to it do for me? This is often a vital question for all web sites and for everybody concerned within the web. SSL(secure sockets layer) is that the backbone of our secure web and it protects sensitive data on a web site. It creates a secure connection between athe server of the company they\u2019re interacting with and with the customer\u2019s web browser. There are several benefits to shift to an https web site, but several peoples issues that it&#8217;ll hurt their search rankings, harm their SEO efforts. After a research on SSL and not SSL based mostly web site Google has come up with an answer for all- \u201cWebsites with HTTPS can perform actually well on search engines to enhance ranking,\u201d says Matt Cutts of Google.<\/p>\n<article id=\"post-4123\" class=\"post-4123 post type-post status-publish format-standard hentry category-tutorials tag-apache-redirect-http-to-https-using-mod_rewrite tag-how-http-to-https-redirection-works tag-http-to-https tag-http-to-https-htaccess tag-http-to-https-iis tag-http-to-https-proxy tag-http-to-https-redirect tag-http-to-https-redirect-htaccess tag-http-to-https-redirect-iis-6 tag-http-to-https-redirect-netscaler tag-http-to-https-redirection tag-iis-redirect-http-to-https tag-rewritehttp-to-https ast-article-single\">\n<div class=\"ast-post-format- ast-no-thumb single-layout-1\">\n<div class=\"entry-content clear\">\n<p>Let\u2019s take a look at the 3 Simple Ways To Redirect a Website From Http to Https,<\/p>\n<h2><strong>Method:1- .<span id=\"dd910a26-a3a3-46ca-a002-ae09da05a6cc\" class=\"GINGER_SOFTWARE_mark\"><span id=\"a2e3da68-1cf1-4f98-88af-5a7fa4b41d0e\" class=\"GINGER_SOFTWARE_mark\"><span id=\"1f059b8d-5e0a-4791-a914-8e03e504ef36\" class=\"GINGER_SOFTWARE_mark\"><span id=\"53ae8fec-d4aa-4db0-993e-41353573a8bc\" class=\"GINGER_SOFTWARE_mark\"><span id=\"6d9a5c4d-1168-483f-a4b2-7660f254dd1a\" class=\"GINGER_SOFTWARE_mark\">htaccess<\/span><\/span><\/span><\/span><\/span>\u00a0file<\/strong><\/h2>\n<p>You can use this code and edit<span id=\"f774cbbb-a99e-451a-a385-55d9c1c6d0e2\" class=\"GINGER_SOFTWARE_mark\"><span id=\"f16209f9-0ffb-4e36-afde-6e25fa8091bf\" class=\"GINGER_SOFTWARE_mark\"><span id=\"7df4c237-b649-46fa-9837-52bf759fb1aa\" class=\"GINGER_SOFTWARE_mark\"><span id=\"aab9b23e-966b-4dc0-9e65-78774c242ee8\" class=\"GINGER_SOFTWARE_mark\"><span id=\"c9ca3195-e752-4aab-8fe6-72ad1c0c900c\" class=\"GINGER_SOFTWARE_mark\">\u00a0.<\/span><\/span><\/span><\/span><\/span><span id=\"6e0d28d2-951f-42ff-ae69-2b482da94380\" class=\"GINGER_SOFTWARE_mark\"><span id=\"501110b0-ea25-4129-b226-6bd7c13a2c97\" class=\"GINGER_SOFTWARE_mark\"><span id=\"e3cb75aa-5eaa-43f0-be59-5c3ea4f56c2d\" class=\"GINGER_SOFTWARE_mark\"><span id=\"ece87c3a-244c-4113-b753-9acd322e7f85\" class=\"GINGER_SOFTWARE_mark\"><span id=\"e3755aca-9b79-4baf-ab73-a2227a737f8e\" class=\"GINGER_SOFTWARE_mark\">htaccess<\/span><\/span><\/span><\/span><\/span>\u00a0file to move from Http to Https,<\/p>\n<p>Please add this to the<span id=\"af6dbce8-e0d2-4949-9823-f2a8f6775116\" class=\"GINGER_SOFTWARE_mark\"><span id=\"2b039fc2-0ee2-45e0-9084-97581a1b21bc\" class=\"GINGER_SOFTWARE_mark\"><span id=\"f35b300a-584a-43d6-9057-afd68bc71897\" class=\"GINGER_SOFTWARE_mark\"><span id=\"68ec905b-8044-496d-bb0e-fee570822819\" class=\"GINGER_SOFTWARE_mark\"><span id=\"eca0ae05-7228-493c-a5a7-364e1f9432ab\" class=\"GINGER_SOFTWARE_mark\">\u00a0.<\/span><\/span><\/span><\/span><\/span><span id=\"b1998a00-70df-4d17-b492-e8f049c3b5bc\" class=\"GINGER_SOFTWARE_mark\"><span id=\"b75d4c72-a7e6-48da-9cde-cdc98bfde808\" class=\"GINGER_SOFTWARE_mark\"><span id=\"41ce28ed-e7e2-4ab5-ba2e-0ba0eb377de9\" class=\"GINGER_SOFTWARE_mark\"><span id=\"5377acf9-91e6-42b4-9746-7ca01062ea8d\" class=\"GINGER_SOFTWARE_mark\"><span id=\"9631bd06-eaaa-43bf-a938-36b2ce1674e8\" class=\"GINGER_SOFTWARE_mark\">htaccess<\/span><\/span><\/span><\/span><\/span>\u00a0file<\/p>\n<p>RewriteEngine On<\/p>\n<p>RewriteCond %<span id=\"e44d77e3-04e2-4be5-88f3-897c8be03bc8\" class=\"GINGER_SOFTWARE_mark\"><span id=\"1fb55110-3763-4834-a6f7-800c0dbde457\" class=\"GINGER_SOFTWARE_mark\"><span id=\"53ad8fae-3fe0-4708-9e6c-343c82c3a4d5\" class=\"GINGER_SOFTWARE_mark\"><span id=\"6ea91314-ab37-43b6-b461-130167958d78\" class=\"GINGER_SOFTWARE_mark\"><span id=\"8784b872-8c09-4b69-a2bf-8143b018da21\" class=\"GINGER_SOFTWARE_mark\">{<\/span><\/span><\/span><\/span><\/span>HTTPS} off<\/p>\n<p>RewriteRule (<span id=\"224eb638-8832-4897-96a5-640a611a46f3\" class=\"GINGER_SOFTWARE_mark\"><span id=\"00ac1a70-07f7-4896-bdbe-b6c27269aa7b\" class=\"GINGER_SOFTWARE_mark\"><span id=\"1c74693f-f4dd-41d4-bbea-e2636d8c53b5\" class=\"GINGER_SOFTWARE_mark\"><span id=\"a9a1df96-6e01-41d6-b803-e9b4902f0634\" class=\"GINGER_SOFTWARE_mark\"><span id=\"b141c258-cd00-4e19-be51-604b236ac596\" class=\"GINGER_SOFTWARE_mark\">.<\/span><\/span><\/span><\/span><\/span>*)\u00a0<span id=\"34ad7e91-fc99-42f6-babe-537549244874\" class=\"GINGER_SOFTWARE_mark\"><span id=\"516ef1c4-ad41-4cf2-8ded-e6bed03d8ced\" class=\"GINGER_SOFTWARE_mark\"><span id=\"5bd3f8a6-3b57-4b4a-b21e-737eadce617d\" class=\"GINGER_SOFTWARE_mark\"><span id=\"e2d02b5c-b19c-4c6d-9941-f3c1267dfd25\" class=\"GINGER_SOFTWARE_mark\"><span id=\"1c3ae23a-c1e0-49a9-86e0-2648bb2f4034\" class=\"GINGER_SOFTWARE_mark\">https<\/span><\/span><\/span><\/span><\/span><span id=\"4721cf9d-1be0-4c84-aa01-cf53d12ea13b\" class=\"GINGER_SOFTWARE_mark\"><span id=\"4c86b8a5-a228-4a8f-a9dd-41827384900e\" class=\"GINGER_SOFTWARE_mark\"><span id=\"f9f5019a-c7ca-4f00-83c0-de40e02c72c7\" class=\"GINGER_SOFTWARE_mark\"><span id=\"4383a5a0-1a10-471e-9349-8d661599238d\" class=\"GINGER_SOFTWARE_mark\"><span id=\"aed29152-1a2e-4d34-8ddc-578e64ee5a0b\" class=\"GINGER_SOFTWARE_mark\">:<\/span><\/span><\/span><\/span><\/span>\/\/%<span id=\"a9a7269f-4b1e-4f4a-b15f-984702bdaea2\" class=\"GINGER_SOFTWARE_mark\"><span id=\"866de291-2fe6-418b-99ae-ca04a258398f\" class=\"GINGER_SOFTWARE_mark\"><span id=\"46887a95-2f22-45ee-affc-c44c6af22b64\" class=\"GINGER_SOFTWARE_mark\"><span id=\"7d6f22b6-232c-4a49-8aa0-611e83f13e18\" class=\"GINGER_SOFTWARE_mark\"><span id=\"6dff94ca-6494-43a6-9a4b-ce2719550e0b\" class=\"GINGER_SOFTWARE_mark\">{<\/span><\/span><\/span><\/span><\/span>HTTP_HOST<span id=\"19bd59fb-debf-4685-88c6-513d27fd29ce\" class=\"GINGER_SOFTWARE_mark\"><span id=\"33745f55-5267-4d62-a6e0-66544d7e3087\" class=\"GINGER_SOFTWARE_mark\"><span id=\"a92c7bc5-4337-4eb4-bd7f-9d8a285d3e9f\" class=\"GINGER_SOFTWARE_mark\"><span id=\"48b0fac9-6348-4afe-8e06-202b2a39d6bb\" class=\"GINGER_SOFTWARE_mark\"><span id=\"c281e1c6-14ad-4157-a686-daeb161d050a\" class=\"GINGER_SOFTWARE_mark\">}<\/span><\/span><\/span><\/span><\/span>%<span id=\"77edac99-917c-49b9-b810-b66aae70f96b\" class=\"GINGER_SOFTWARE_mark\"><span id=\"88380dc8-1992-45fc-8452-5331cb6ff362\" class=\"GINGER_SOFTWARE_mark\"><span id=\"8913b6df-84ba-4087-9e27-2a3b103682b7\" class=\"GINGER_SOFTWARE_mark\"><span id=\"5318e6f4-6fe7-4969-9d13-d93b093b5374\" class=\"GINGER_SOFTWARE_mark\"><span id=\"8e2d0c97-de4d-4c43-84b6-1353b45481eb\" class=\"GINGER_SOFTWARE_mark\">{<\/span><\/span><\/span><\/span><\/span>REQUEST_URI}<\/p>\n<p>Generally websites use the\u00a0<span id=\"c51d16d2-98ff-4f55-a556-18636287c7c6\" class=\"GINGER_SOFTWARE_mark\"><span id=\"4a54bf94-5e49-41b9-8a08-8c6146f4648e\" class=\"GINGER_SOFTWARE_mark\"><span id=\"edb3f7a3-c913-4b24-b26c-1280ad311f85\" class=\"GINGER_SOFTWARE_mark\"><span id=\"3416afd7-faf2-43ce-b3d9-6fb398782e49\" class=\"GINGER_SOFTWARE_mark\"><span id=\"e47425ec-35fa-40e1-8389-2704a8bcc1e5\" class=\"GINGER_SOFTWARE_mark\">http<\/span><\/span><\/span><\/span><\/span>\u00a0protocol as a default protocol to handle all the information, but Https can be a secure way to run a website online.<\/p>\n<h3><strong>How it Works?<\/strong><\/h3>\n<p>The three commands: RewriteEngine, RewriteCond and RewriteRule.<\/p>\n<p>The \u201cRewriteEngine On\u201d tells Apache we are going to use mod_rewrite. The \u201cRewriteCond % {HTTPS}\u201d off, to check if the\u00a0<span id=\"c8323d4e-784c-4e89-b718-e30bd84e6afe\" class=\"GINGER_SOFTWARE_mark\"><span id=\"d36d76a6-f3cb-4e69-a422-3c3f40ccb6ce\" class=\"GINGER_SOFTWARE_mark\"><span id=\"1e4f6065-9675-47e8-988f-2ba9d1d95550\" class=\"GINGER_SOFTWARE_mark\"><span id=\"44c76ccf-e836-4137-a55f-defa95331a89\" class=\"GINGER_SOFTWARE_mark\">https<\/span><\/span><\/span><\/span>\u00a0protocol is active or not, and If the\u00a0<span id=\"8bd18150-7b82-4033-8d98-456ff2819a80\" class=\"GINGER_SOFTWARE_mark\"><span id=\"9370e9f8-fcfd-4328-9065-4f77e07ba1f4\" class=\"GINGER_SOFTWARE_mark\"><span id=\"9f7c5e47-b87a-4e79-bfa0-abab814d315d\" class=\"GINGER_SOFTWARE_mark\"><span id=\"3a979b1a-4982-4f09-8ac3-6cc25d586c0d\" class=\"GINGER_SOFTWARE_mark\">https<\/span><\/span><\/span><\/span>\u00a0protocol is used then the last line (RewriteRule) will not apply. The last line \u201cRewriteRule (<span id=\"d418eb1b-20e8-416b-ae4f-e1d7da346f68\" class=\"GINGER_SOFTWARE_mark\"><span id=\"f4d93a47-39e7-43f3-8e28-750f2f197384\" class=\"GINGER_SOFTWARE_mark\"><span id=\"9e8f9ca7-5490-42c9-9e39-a368e964e45b\" class=\"GINGER_SOFTWARE_mark\"><span id=\"83353518-259a-424d-934e-c56846f806d4\" class=\"GINGER_SOFTWARE_mark\">.<\/span><\/span><\/span><\/span>*)\u00a0<span id=\"942c05a7-ef27-49bd-9fb9-d07d547ef534\" class=\"GINGER_SOFTWARE_mark\"><span id=\"ee0dad3b-b2d5-4162-a460-577ebbc34b2f\" class=\"GINGER_SOFTWARE_mark\"><span id=\"fc24a6f4-9154-497a-bf09-c6b8fdd2d042\" class=\"GINGER_SOFTWARE_mark\"><span id=\"eb0b419e-28b8-4b86-859f-cb8a47196d74\" class=\"GINGER_SOFTWARE_mark\">https<\/span><\/span><\/span><\/span><span id=\"f04e2a54-fe98-4e4d-9584-4e9ff6a83716\" class=\"GINGER_SOFTWARE_mark\"><span id=\"96d9629f-bbe5-4e95-be98-0c23d38cc98a\" class=\"GINGER_SOFTWARE_mark\"><span id=\"662ae3ba-bfe4-4144-be93-807f4df563f1\" class=\"GINGER_SOFTWARE_mark\"><span id=\"1b4d22f5-5b67-4348-b5a2-1f3f840ba6ef\" class=\"GINGER_SOFTWARE_mark\">:<\/span><\/span><\/span><\/span>\/\/%<span id=\"880d0699-3a9a-41cf-9fa5-4e959462a03f\" class=\"GINGER_SOFTWARE_mark\"><span id=\"990471d6-14d9-4432-8f0f-0d65060e6354\" class=\"GINGER_SOFTWARE_mark\"><span id=\"3e2c3799-39fa-45ab-b2e7-050ae0d955f6\" class=\"GINGER_SOFTWARE_mark\"><span id=\"15188e2d-205f-4aa5-9b67-29e9fee6b3b1\" class=\"GINGER_SOFTWARE_mark\">{<\/span><\/span><\/span><\/span>HTTP_HOST<span id=\"cc0c512e-a0a9-401c-bf76-6ca16986ba4b\" class=\"GINGER_SOFTWARE_mark\"><span id=\"87419a48-23d9-4f47-992d-6251561775d7\" class=\"GINGER_SOFTWARE_mark\"><span id=\"74db7c42-c327-4db8-9c2a-530916bfc4a0\" class=\"GINGER_SOFTWARE_mark\"><span id=\"719c32e2-a813-4096-ad32-de91d0724299\" class=\"GINGER_SOFTWARE_mark\">}<\/span><\/span><\/span><\/span>%<span id=\"ff945e84-4ca2-43ad-b5fe-8d97eb5812ec\" class=\"GINGER_SOFTWARE_mark\"><span id=\"741501f3-3333-4a3a-868b-4b79531371a1\" class=\"GINGER_SOFTWARE_mark\"><span id=\"03b21637-cfae-4fe5-ae77-f4db51821a56\" class=\"GINGER_SOFTWARE_mark\"><span id=\"27920d34-f5b8-42fe-948b-28b2aada78fc\" class=\"GINGER_SOFTWARE_mark\">{<\/span><\/span><\/span><\/span>REQUEST_URI}\u201d tell the server to only rewrite the first part (http:\/\/) to (https:\/\/).<\/p>\n<h2><strong>Method:2 \u2013 Using\u00a0<span id=\"09842e45-758e-4f50-9394-8e1bebd94c06\" class=\"GINGER_SOFTWARE_mark\"><span id=\"07e0afea-7e6f-4bb7-a44f-9740b80082d4\" class=\"GINGER_SOFTWARE_mark\"><span id=\"ad39ca5f-febf-4ac7-a0e6-fac0b0dbd8a1\" class=\"GINGER_SOFTWARE_mark\"><span id=\"490f151b-95c9-4a30-b81a-077026e7a788\" class=\"GINGER_SOFTWARE_mark\">php<\/span><\/span><\/span><\/span>\u00a0Function<\/strong><\/h2>\n<p>You can use the following\u00a0<span id=\"2de3a052-9c76-408e-8043-beb36f0247ad\" class=\"GINGER_SOFTWARE_mark\"><span id=\"5054462a-5f6f-4077-9526-72840deb9981\" class=\"GINGER_SOFTWARE_mark\"><span id=\"65e05813-55a4-40f3-95f0-1c77e1002c9e\" class=\"GINGER_SOFTWARE_mark\">php<\/span><\/span><\/span>\u00a0function to redirect your website using\u00a0<span id=\"46d0009f-6c85-4159-b986-cbc3374704d9\" class=\"GINGER_SOFTWARE_mark\"><span id=\"43e287ca-4a8d-46ed-ad50-1e50e309ca07\" class=\"GINGER_SOFTWARE_mark\"><span id=\"3bb97a01-21d0-4843-adbf-f87e3b464a20\" class=\"GINGER_SOFTWARE_mark\">php<\/span><\/span><\/span>\u00a0code. You just have to call the function in the page at appropriate place where you need the redirect from http to https.<\/p>\n<p>&lt;\u00a0<span id=\"a1e27231-0ce3-4ffe-9c00-adf9635f8133\" class=\"GINGER_SOFTWARE_mark\"><span id=\"cf47f907-7994-458f-961f-80f752cad73f\" class=\"GINGER_SOFTWARE_mark\"><span id=\"56f64d9b-f9de-4516-809b-9c29fd6751b3\" class=\"GINGER_SOFTWARE_mark\">?<\/span><\/span><\/span><span id=\"88732dd8-cb7a-4182-9df9-bd8d6c0828a7\" class=\"GINGER_SOFTWARE_mark\"><span id=\"dce326df-2798-45e2-b722-0bc7cdfa540a\" class=\"GINGER_SOFTWARE_mark\"><span id=\"b3c13d2d-d906-4189-9bae-c314645552a3\" class=\"GINGER_SOFTWARE_mark\">php<\/span><\/span><\/span><\/p>\n<p><span id=\"47a21ea0-19a5-49dc-a6ea-e38a6fa92abd\" class=\"GINGER_SOFTWARE_mark\"><span id=\"cb759418-b70f-4caa-a842-9d51d2aab624\" class=\"GINGER_SOFTWARE_mark\"><span id=\"67c65f5f-1819-42f1-973c-4aff6a8d4bff\" class=\"GINGER_SOFTWARE_mark\">function<\/span><\/span><\/span>\u00a0<span id=\"2c9c55bd-ebc3-4782-9172-7240946aefe0\" class=\"GINGER_SOFTWARE_mark\"><span id=\"09e091c3-a1c3-46dd-b45d-f25e0d95fc8f\" class=\"GINGER_SOFTWARE_mark\"><span id=\"14c523a9-2c87-457d-9266-c35c3e4dd107\" class=\"GINGER_SOFTWARE_mark\">redirectTohttps<\/span><\/span><\/span><span id=\"08414cf6-76f5-4076-aece-f5c042433d42\" class=\"GINGER_SOFTWARE_mark\"><span id=\"3db12d60-f645-47c0-a963-530ca1b0c21c\" class=\"GINGER_SOFTWARE_mark\"><span id=\"33d63dc8-a6a0-48fa-a680-81228434630d\" class=\"GINGER_SOFTWARE_mark\">(<\/span><\/span><\/span>) {<\/p>\n<p><span id=\"d8115315-c241-4e08-87cd-a6c4b12c460a\" class=\"GINGER_SOFTWARE_mark\"><span id=\"edbfbb2b-7acb-40ca-8529-843189f3ec93\" class=\"GINGER_SOFTWARE_mark\"><span id=\"1824b864-d860-4ac5-b1f3-a013939f6e09\" class=\"GINGER_SOFTWARE_mark\">if<\/span><\/span><\/span><span id=\"b0c6dfcc-aae0-4097-8dfe-cbd863974188\" class=\"GINGER_SOFTWARE_mark\"><span id=\"6e2a8cb1-d3a2-4312-a391-79830636065a\" class=\"GINGER_SOFTWARE_mark\"><span id=\"c08555d4-43cb-4352-8501-09ac659de5ef\" class=\"GINGER_SOFTWARE_mark\">(<\/span><\/span><\/span>$_SERVER<span id=\"13224f11-2db6-4db8-bfe7-a1788c5c909b\" class=\"GINGER_SOFTWARE_mark\"><span id=\"d9a42f98-cc69-4d54-b8f0-9a79d57e0590\" class=\"GINGER_SOFTWARE_mark\"><span id=\"62081d2f-6986-446e-82fc-dc2cbff6062f\" class=\"GINGER_SOFTWARE_mark\">[<\/span><\/span><\/span>\u2018HTTPS\u2019]<span id=\"611060fb-bdc6-4e88-970a-98720687e8a7\" class=\"GINGER_SOFTWARE_mark\"><span id=\"cbb46c78-3a70-472b-953e-e2a63c056c79\" class=\"GINGER_SOFTWARE_mark\"><span id=\"7a005301-d2f4-4b8c-9bce-509ff7ef6311\" class=\"GINGER_SOFTWARE_mark\">!<\/span><\/span><\/span>=\u201don\u201d) {<\/p>\n<p>$redirect= \u201c<span id=\"2ba4f5b9-1db7-40f6-bf84-43d411c76c8b\" class=\"GINGER_SOFTWARE_mark\"><span id=\"d4cde8e8-0139-4813-9842-fa9f7d8c7617\" class=\"GINGER_SOFTWARE_mark\"><span id=\"d3930f20-6859-47c1-8464-2791c062da68\" class=\"GINGER_SOFTWARE_mark\">https<\/span><\/span><\/span><span id=\"e4ca0367-b378-48a9-ba7e-7eda5aef4e2a\" class=\"GINGER_SOFTWARE_mark\"><span id=\"14f8c6e8-ccc8-410d-b9f5-c1cd8db2512f\" class=\"GINGER_SOFTWARE_mark\"><span id=\"8d57dfac-7f88-4365-b9f7-9669b0e8efeb\" class=\"GINGER_SOFTWARE_mark\">:<\/span><\/span><\/span>\/\/\u201d<span id=\"29293523-ce2a-4c45-8c2c-92419e5bb70c\" class=\"GINGER_SOFTWARE_mark\"><span id=\"563cfefb-d669-472d-980f-bd3a0439090b\" class=\"GINGER_SOFTWARE_mark\"><span id=\"54d56075-b841-4edf-9b6e-e069b7449ec8\" class=\"GINGER_SOFTWARE_mark\">.<\/span><\/span><\/span>$_SERVER<span id=\"64df387a-3602-423a-830c-bfc9b390e2f0\" class=\"GINGER_SOFTWARE_mark\"><span id=\"b36bc01c-83ca-425c-b0ea-6aa194fcc69b\" class=\"GINGER_SOFTWARE_mark\"><span id=\"191b209a-1cbe-4a7b-bc1d-63616f858b81\" class=\"GINGER_SOFTWARE_mark\">[<\/span><\/span><\/span>\u2018HTTP_HOST\u2019]<span id=\"a8eaf04f-0966-4080-a658-b44001bf1a00\" class=\"GINGER_SOFTWARE_mark\"><span id=\"495a5e77-a172-4e79-9ea0-00bc8ac523f8\" class=\"GINGER_SOFTWARE_mark\"><span id=\"f0f05b5c-efaa-42f1-bb32-aded8f3a0bd1\" class=\"GINGER_SOFTWARE_mark\">.<\/span><\/span><\/span>$_SERVER<span id=\"438cadb3-54a9-4129-a4a5-9241a6d0f7c1\" class=\"GINGER_SOFTWARE_mark\"><span id=\"9dcfef41-1572-4ed0-806a-fd583088a60f\" class=\"GINGER_SOFTWARE_mark\"><span id=\"6cb217de-5c5f-4758-bd59-4bb275e9fa55\" class=\"GINGER_SOFTWARE_mark\">[<\/span><\/span><\/span>\u2018REQUEST_URI\u2019];<\/p>\n<p><span id=\"9a1e8664-16fc-4c38-9c02-fa2b2debb9f8\" class=\"GINGER_SOFTWARE_mark\"><span id=\"3c47e605-f061-4ff5-acaf-6706eccc09d9\" class=\"GINGER_SOFTWARE_mark\"><span id=\"f8e87827-6812-4b37-9648-acc9eb53cc24\" class=\"GINGER_SOFTWARE_mark\">header<\/span><\/span><\/span><span id=\"faa070e5-ac63-4071-a20a-a4997e20ccc5\" class=\"GINGER_SOFTWARE_mark\"><span id=\"b94f33a0-fb3f-4d77-b7b2-b21efd003818\" class=\"GINGER_SOFTWARE_mark\"><span id=\"99dedf96-22a2-431d-86f8-cc8d4149ea37\" class=\"GINGER_SOFTWARE_mark\">(<\/span><\/span><\/span>\u201cLocation<span id=\"8490d723-065f-4f39-8bbf-8ce20f3235ed\" class=\"GINGER_SOFTWARE_mark\"><span id=\"c4d9b1fb-08b8-4913-b918-9fa89436dcf4\" class=\"GINGER_SOFTWARE_mark\"><span id=\"2777020b-fae8-46da-816e-54a2945284fd\" class=\"GINGER_SOFTWARE_mark\">:<\/span><\/span><\/span>$redirect\u201d);<span id=\"88252ebe-5af1-4732-bc41-86171930e087\" class=\"GINGER_SOFTWARE_mark\"><span id=\"4b4ce137-d011-4ad2-a69c-f6ea4306879d\" class=\"GINGER_SOFTWARE_mark\"><span id=\"c5830868-5d2a-42a2-9ca0-45d1f1192948\" class=\"GINGER_SOFTWARE_mark\">\u00a0}<\/span><\/span><\/span><span id=\"52f3da50-89b5-4749-9488-e7a907a8c23b\" class=\"GINGER_SOFTWARE_mark\"><span id=\"1e0243cb-2019-42a1-b063-2e64c2fb3c8e\" class=\"GINGER_SOFTWARE_mark\"><span id=\"e87ce668-5c71-4995-9c90-b65edf18fa2a\" class=\"GINGER_SOFTWARE_mark\">\u00a0}<\/span><\/span><\/span><\/p>\n<p>?&gt;<\/p>\n<h3><strong>How it Works?<\/strong><\/h3>\n<p>Please check first that SSL is installed on the server. Now to redirect the browser to \u201chttps\u201d<span id=\"e73ac5c4-4352-4789-b801-4e7b87c96fc7\" class=\"GINGER_SOFTWARE_mark\"><span id=\"e71e28e8-8adb-4963-addc-0adc645d9b5b\" class=\"GINGER_SOFTWARE_mark\"><span id=\"5224c10e-3d4a-4d81-9f2a-1fcb67aa4f6f\" class=\"GINGER_SOFTWARE_mark\">\u00a0,<\/span><\/span><\/span>\u00a0You must know that the site is using SSL or not at the moment. And for this, there is a defined server variable in PHP called \u201cHTTPS\u201d. $_SERVER<span id=\"7892b78d-7e23-4995-b3d8-c3f217881c63\" class=\"GINGER_SOFTWARE_mark\"><span id=\"127ac37a-0b6e-4e4a-8854-069d794cc52b\" class=\"GINGER_SOFTWARE_mark\"><span id=\"a14a09e8-ff05-42d7-b57b-d45ce3c5c70a\" class=\"GINGER_SOFTWARE_mark\">[<\/span><\/span><\/span>\u2018HTTPS\u2019] returns \u201con\u201d values when the site is using an SSL connection.<\/p>\n<h2>\u00a0<strong>Method :3 \u2013 HTML Meta Tag<\/strong><\/h2>\n<p>Above two methods are enough to make a move from Http to Https, in comparison this method is not the most perfect one, but you can use it if you are not able to use the \u201cmod rewrite\u201d.<\/p>\n<p>Please add the following code to your web page header,<\/p>\n<p>&lt;\u00a0<span id=\"ddbc0606-4d7b-4b4b-8224-2376583cf991\" class=\"GINGER_SOFTWARE_mark\"><span id=\"d3195e5a-c249-4218-a596-53028fb5939b\" class=\"GINGER_SOFTWARE_mark\"><span id=\"c8b07f47-18a7-4ea7-8234-3d888794b128\" class=\"GINGER_SOFTWARE_mark\">meta<\/span><\/span><\/span>\u00a0http-equiv=\u201dRefresh\u201d content=\u201d0;URL=https:\/\/www.yourdomainname.com\u201d \/&gt;<\/p>\n<h3><strong>How it Works?<\/strong><\/h3>\n<p>Please make sure the site with SSL encryption is listening only on port 443 for the IP address you\u2019ve assigned. Now create a separate website using similar IP address, which pay attention to port 80. Create a single file at the root level and call it as default.htm or default.asp. Use meta refresh tag, if you want to use HTML.<\/p>\n<\/div>\n<\/div>\n<\/article>\n","protected":false},"excerpt":{"rendered":"<p>The major part in hosting an web site on-line is to look for its security as a result nowadays malicious activities have increased from 45% on the servers with no security protocols. SSL is a decent choice over it, however beware of open source SSL that is free, but at constant time not secure to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[],"class_list":["post-1681","post","type-post","status-publish","format-standard","hentry","category-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v15.2.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>3 Simple Ways To Redirect a Website From Http to Https<\/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:\/\/ownwebservers.com\/kb\/1681\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"3 Simple Ways To Redirect a Website From Http to Https\" \/>\n<meta property=\"og:description\" content=\"The major part in hosting an web site on-line is to look for its security as a result nowadays malicious activities have increased from 45% on the servers with no security protocols. SSL is a decent choice over it, however beware of open source SSL that is free, but at constant time not secure to [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ownwebservers.com\/kb\/1681\/\" \/>\n<meta property=\"og:site_name\" content=\"OWS KB\" \/>\n<meta property=\"article:published_time\" content=\"2021-09-06T09:59:47+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-09-06T10:01:34+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\">\n\t<meta name=\"twitter:data1\" content=\"admin\">\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:\/\/ownwebservers.com\/kb\/#website\",\"url\":\"https:\/\/ownwebservers.com\/kb\/\",\"name\":\"OWS KB\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/ownwebservers.com\/kb\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/1681\/#webpage\",\"url\":\"https:\/\/ownwebservers.com\/kb\/1681\/\",\"name\":\"3 Simple Ways To Redirect a Website From Http to Https\",\"isPartOf\":{\"@id\":\"https:\/\/ownwebservers.com\/kb\/#website\"},\"datePublished\":\"2021-09-06T09:59:47+00:00\",\"dateModified\":\"2021-09-06T10:01:34+00:00\",\"author\":{\"@id\":\"https:\/\/ownwebservers.com\/kb\/#\/schema\/person\/4a40fe3fe17a08ddd1d7c113668e75f2\"},\"breadcrumb\":{\"@id\":\"https:\/\/ownwebservers.com\/kb\/1681\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ownwebservers.com\/kb\/1681\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/1681\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/\",\"url\":\"https:\/\/ownwebservers.com\/kb\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/1681\/\",\"url\":\"https:\/\/ownwebservers.com\/kb\/1681\/\",\"name\":\"3 Simple Ways To Redirect a Website From Http to Https\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/#\/schema\/person\/4a40fe3fe17a08ddd1d7c113668e75f2\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ba5db5841d48bd7517bb2583e13983e6d2fa56a4099a0b3c61ad2daefc321303?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"https:\/\/ownwebservers.com\/kb\"]}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","_links":{"self":[{"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/posts\/1681","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/comments?post=1681"}],"version-history":[{"count":2,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/posts\/1681\/revisions"}],"predecessor-version":[{"id":1683,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/posts\/1681\/revisions\/1683"}],"wp:attachment":[{"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/media?parent=1681"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/categories?post=1681"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/tags?post=1681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}