Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Network Solutions and Force HTTPS problems WordPress

  • SOLVED

I am looking for anyone who has dealt with this problem with Network Solutions Hosting not supporting Force HTTPS that woocommerce uses to secure it't checkout page or apparently any other for that matter.

Network Solutions offers the following code as the best redirect available from http:// to https:// in Javascript, saying that there is no way to do it server side.

<script language="javascript">
if (document.location.protocol != "https:")
{
document.location.href = "https://subdomain.yourdomain.com" + document.location.pathname;
};
</script>

to be found at http://www.networksolutions.com/support/ssl-redirects/

If this works, I specifically need to know where to put this code, Network solutions has said on any page that needs forced https which in this case is the CHECKOUT page.

I need specific locations to insert this code. One other programmer gave the following code to insert with the following instruction which i had no clue what it meant "You are should edit $pages array only."

function ys_wp_footer_force_ssl() {

$pages = array(

'/products-page/checkout/',

'/other-page/'

);

// End edit.



if ( empty( $pages ) )

return;



foreach ( $pages as &$page ) {

$page = sprintf( '"%s" == document.location.pathname', $page );

}

?>

<script type="text/javascript">

alert( document.location.pathname) ;

if (document.location.protocol != "https:") {

if ( <?php echo implode( ' || ', $pages ); ?> ) {

document.location.href = "https://subdomain.yourdomain.com" + document.location.pathname;

}

}

</script>

<?php

}

add_action( 'wp_footer', 'ys_wp_footer_force_ssl' );


You are should edit $pages array only.

Answers (1)

2013-06-09

Yakir Sitbon answers:

Hi.
You have $pages array. You just need edit the values there.

If you want, please tell me which page you want to force, and I edit your $pages array.

Yakir.


movino4me comments:

so far all I can see that needs to be secure is the woocommerce Checkout page.

I will also need to know the specifics of doing this if possible since I will need to do this again. I feel comfortable doing the work as long as I know where it belongs. I would be happy having you do this one for me though!

How can we proceed to have you do this work?


Yakir Sitbon comments:

Hi.

I just need to know what is URL of your Woocoomerce Checkout page, and which other pages you need to secure. I will change the code for you.

Yakir.


movino4me comments:

I would need the following
http://lattanziowines.com/products-page/checkout/
http://lattanziowines.com/my-account/ and any other pages involved with my account such as
http://lattanziowines.com/my-account/change-password/
http://lattanziowines.com/my-account/edit-address/
http://lattanziowines.com/my-account/lost-password/
http://lattanziowines.com/my-account/view-order/

There may be others as I test it but this is why it would be helpful to see the file that you modify after you are done so that I can change any others if necessarY

I really appreciate this!


Yakir Sitbon comments:

function ys_wp_footer_force_ssl() {
$pages = array(
'/products-page/checkout/',
'/my-account/',
'/my-account/change-password/',
'/my-account/edit-address/',
'/my-account/lost-password/',
'/my-account/view-order/',
);
// End edit.

if ( empty( $pages ) )
return;

foreach ( $pages as &$page ) {
$page = sprintf( '"%s" == document.location.pathname', $page );
}
?>
<script type="text/javascript">
if (document.location.protocol != 'https:') {
if ( <?php echo implode( ' || ', $pages ); ?> ) {
document.location.href = 'https://lattanziowines.com' + document.location.pathname;
}
}
</script>
<?php
}
add_action( 'wp_footer', 'ys_wp_footer_force_ssl' );


Tell me know if you get useful from my help. :)


movino4me comments:

So you will need administrator access to place this code? where exactly does this code go?


Yakir Sitbon comments:

You can send me FTP account in PM.
OR put this code in your functions.php file.

Yakir


movino4me comments:

I will have you do the first one. Please let me know how to pm you.