Archived

This topic is now archived and is closed to further replies.

  • 0

Ssl Error On Force Ssl Page

Question

Posted · Report post

Ok. 

So this is my last ssl related post. I promise. 

Currently my site - justseti.com is completely secure. The entire site is set to be 'force ssl' using the wordpress https plugin. 

Of course the Site Url is also set to https:// which I wouldn't need the plugin for. 

 

Now. When I choose to only 'force ssl' on the checkout page, then the checkout page loses most of it's css. 

The sidebar drops to the bottom of the page and mayhem breaks lose.

please see screenshots.

 

I can't keep this live to show anyone because the site is live. 

I've uninstalled the cdn and the cache and the problem persists. 

 

I've also put this in the pagelines customize file:

add_filter( 'pless_vars', 'make_ssl_vars' );
	add_action( 'pl_force_ssl', '__return_true' );
	
	function make_ssl_vars( $vars ) {
	
		$vars['plSectionsRoot'] = str_replace( 'http://','>http://','>http://','>http://','>http://','>http://','>http://','>http://', 'https://','>https://','>https://','>https://','>https://','>https://','>https://','>https://', $vars['plSectionsRoot'] );
			$vars['plRoot'] = str_replace( 'http://','>http://','>http://','>http://','>http://','>http://','>http://','>http://', 'https://','>https://','>https://','>https://','>https://','>https://','>https://','>https://', $vars['plRoot'] );
		return $vars;
	}

 

But it doesn't solve the problem. 

 

Also disabled wordpress https plugin and used this code to force ssl :

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

function yst_checkout_page_ssl( $permalink, $post, $leavename ) {

  if ( 67 == $post->ID )

    return preg_replace( '|^http://|','>http://|', 'https://','>https://','>https://','>https://','>https://','>https://','>https://','>https://', $permalink );

  return $permalink;

}

add_filter( 'pre_post_link', 'yst_checkout_page_ssl', 10, 3 );

 

still no luck~ 

Share this post


Link to post
Share on other sites

9 answers to this question

Posted · Report post

Thanks for kindly considering others!  I've closed this as you requested.

Share this post


Link to post
Share on other sites

Posted · Report post

The reason why I don't want to force ssl the entire site is because it slows down the site. 

I'd really like only the checkout page to be force ssl. 

g

Share this post


Link to post
Share on other sites

Posted · Report post

Ok. i tried this code in the .htaccess as an alternative:

# force https for all URLs within /checkout
RewriteCond %{HTTPS} =off
RewriteRule ^checkout https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

# do not do anything for existing files
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .+ - [L]

# force http for all other URLs that are not within /checkout
RewriteCond %{HTTPS} =on
RewriteCond %{REQUEST_URI} !^/checkout
RewriteRule .* http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

 

Still no luck! 

Same problem happens.

Share this post


Link to post
Share on other sites

Posted · Report post

I have a feeling the SSL may be causing similar issues on my site.

I use WooCommerce and I have found that 'My Account' page and 'Checkout' page have problems.  The footer is dropped and the bottom portion of the content is often sliced itself (no credit card fill-in boxes and saved credit card information is missing). The product pages will no longer show widgets either.

Share this post


Link to post
Share on other sites

Posted · Report post

@gayatriom

 

When I visit your site it is not https but http?

 

@MoreApplesADay

 

I have recently replied to your post about this issue, please read my reply.

Share this post


Link to post
Share on other sites

Posted · Report post

Your htaccess rules look wierd, you dont need = there, also your htaccess is gonna redirect images etc to non ssl.

Share this post


Link to post
Share on other sites

Posted · Report post

OK. after playing with this further, I discovered the following:

 

Even though my site url is set to Https://, the site is accessible via http:// also . 

If I force ssl, it 'duplicates' jigoshops efforts to force ssl and causes the css issue. 

 

If I just allow jigoshop to force ssl and don't use wordpress https plugin or any code that redirects non force ssl pages from https:// to http://, then 

the checkout page doesn't go all wonky. 

 

What this leaves is two 'access pages' for the same page - a https version and http version depending on which link a user clicks. 

 

We can close this. 

I know i didn't provide a solution, but perhaps someone as confused as I was about what was going on will be benefited. 

Share this post


Link to post
Share on other sites