I want to disable all https request and I want to redirect all https request to http in openshift wordpress application.
I tried lots of code.
Nothing happened after this code.
RewriteEngine On
RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
I tried this below code too. But it shown me redirecting loop error.
RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} https
RewriteRule .* http://%{HTTP_HOST}%{REQUEST_URI} [R,L]
I also tried by creating wordpress plugin. But this code also shown me redirecting loop error.
add_action( 'template_redirect', 'hkp_ssl_template_redirect', 1 );
function hkp_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();
}
}
}
I also tried below code in .htaccess
Method 1.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
</IfModule>
Method 2.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule .* http://%{HTTP_HOST}%{REQUEST_URI}
</IfModule>
All above code has not working openshift wordpress. Can you please guide me how can I implement this.
Thanks