It works! Thank you Sir Paul. And for those running forced …

By 19th October 2021 Uncategorised

Comment on WordPress CloudFlare Flexible SSL – Making It Work by Mark Llego.

It works! Thank you Sir Paul.

And for those running forced SSL on admin and you don’t want links to the front end to remain https here’s the code I’m using.

	add_action( 'template_redirect', 'bhww_ssl_template_redirect', 1 );
 
	function bhww_ssl_template_redirect() {
 
		if ( is_ssl() && !is_admin() ) {
		
			if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {
			
				wp_redirect( preg_replace( '|^https://|', 'http://', $_SERVER['REQUEST_URI'] ), 301 );
				exit();
				
			} else {
			
				wp_redirect( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 301 );
				exit();
				
			}
			
		}
		
	}

x Logo: ShieldPRO
This Site Is Protected By
ShieldPRO