{"id":86,"date":"2019-10-07T11:39:28","date_gmt":"2019-10-07T10:39:28","guid":{"rendered":"http:\/\/www.freelancewp.guide\/?p=86"},"modified":"2019-10-07T11:39:28","modified_gmt":"2019-10-07T10:39:28","slug":"wordpress-redirect-https-to-http-without-ssl-certificate","status":"publish","type":"post","link":"https:\/\/freelancewp.guide\/wordpress-redirect-https-to-http-without-ssl-certificate\/","title":{"rendered":"WordPress redirect https to http without SSL certificate"},"content":{"rendered":"\n

If your website has an invalid SSL certificate for your site (perhaps your shared hosting company has a wildcard certificate), most browsers will show a warning about the validity of the certiticate.<\/p>\n\n\n\n

However, Google could still index your site using https: URLs, as it assumes you have a valid\u00a0SSL certificate.<\/p>\n\n\n\n

The problem is, if people click the links from Google, they get the browser warning.<\/p>\n\n\n\n

Changes to your htaccess file wont work as.<\/p>\n\n\n\n

Here is a php snippet you can drop into your theme functions.php. It redirects at the PHP level.<\/p>\n\n\n\n

\/\/ Avoid SSL on Google\nadd_action( 'template_redirect', 'bhww_ssl_template_redirect', 1 );\nfunction bhww_ssl_template_redirect() {\n  $https = ( $_SERVER['HTTP_X_HTTPS'] == 'On' );\n  if ( $https ) {\n    if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {\n      wp_redirect( preg_replace( '|^https:\/\/|', 'http:\/\/', $_SERVER['REQUEST_URI'] ), 301 );\n      exit();\n    } else {\n      wp_redirect( \u2018http:\/\/\u2019 . $_SERVER[\u2018HTTP_HOST\u2019] . $_SERVER[\u2018REQUEST_URI\u2019], 301 );\n      exit();\n    }\n  }\n}<\/code><\/pre>\n\n\n\n

<\/p>\n","protected":false},"excerpt":{"rendered":"

If your website has an invalid SSL certificate for your site (perhaps your shared hosting company has a wildcard certificate), most browsers will show a warning about the validity of the certiticate. However, Google could still index your site using https: URLs, as it assumes you have a valid\u00a0SSL certificate. The problem is, if people […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"footnotes":""},"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/freelancewp.guide\/wp-json\/wp\/v2\/posts\/86"}],"collection":[{"href":"https:\/\/freelancewp.guide\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/freelancewp.guide\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/freelancewp.guide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/freelancewp.guide\/wp-json\/wp\/v2\/comments?post=86"}],"version-history":[{"count":0,"href":"https:\/\/freelancewp.guide\/wp-json\/wp\/v2\/posts\/86\/revisions"}],"wp:attachment":[{"href":"https:\/\/freelancewp.guide\/wp-json\/wp\/v2\/media?parent=86"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/freelancewp.guide\/wp-json\/wp\/v2\/categories?post=86"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/freelancewp.guide\/wp-json\/wp\/v2\/tags?post=86"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}