News:

Looking for documentation? Take a look on our wiki

Main Menu

How do you enable Https in VM2

Started by rlspencer, September 28, 2011, 05:24:06 AM

Previous topic - Next topic

Dokho


Dokho

Hey Everyone !

Some notice about my question ?

gsullins

I too need a solution for the https to generally be prevented with rest of website, after the checkout (sensitive) area is visited.  It causes a problem with session ID - "add to cart" buttons stop working when you return shopping (with https).

dragonita

#18
Quote from: alatak on January 03, 2012, 15:50:05 PM
Hi,

Ok. I will check then :)
Any solution for this? I have the same issue and my client pay a lot for a SSL that we can not use... Please help!
Also posted same issues with more people here:
http://forum.virtuemart.net/index.php?topic=100584.0

btw, when I use google chrome I do not get a green https on the checkout, Y get https with a cross on it...Google says that the certificate or some are not secure..... I´m lost...
Technology is a mystery that we want to solve for your, take action: contact dragonita.com

willxiao0790

Quote from: dragonita on May 09, 2012, 11:11:26 AM

btw, when I use google chrome I do not get a green https on the checkout, Y get https with a cross on it...Google says that the certificate or some are not secure..... I´m lost...

This can be some of your contents are insecure, for more detailed, all contents including links, files, images, etc must be starting with https

So, you better use relative url for content such as /shop/logo.png

You can use this http://www.whynopadlock.com/ to check which elements are insecure and try to fix them out.

Hope this help.

JohnHunter

#20
This has been an issue for a short while, as it seems that there are soo many server configurations and versions of VM or Joomla variations...

This is what worked for me:

adding to you main Joomla! template just after the <head> tag before and css or .js loads

<?php if ((JRequest::getVar('option') == 'com_virtuemart' and JRequest::getVar('view') == 'user' || JRequest::getVar('view') == 'orders'  || JRequest::getVar('view') == 'cart'  )): ?>
<?php if($_SERVER['SERVER_PORT'] != '443') { header('Location: https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); exit(); } ?>
<?php endif; ?>


<?php if ((JRequest::getVar('view') !== 'cart' )): ?>
<?php if ((JRequest::getVar('view') !== 'user' )): ?>
<?php if ((JRequest::getVar('view') !== 'orders'  )): ?>
<?php if($_SERVER['SERVER_PORT'] != '80') { header('Location: http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); exit(); } ?>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>

not really tested with SEF turned on (built in or add-on)
works for me with the latest (as of june 5th 2012)  Virtuemart 2.0.7.b  and Joomla! 2.5.4

the only problem I noticed, is when logged in (front-end) with the main super user, I'm brought to the vendor screen (as designed) and the vendor image does not load in ssl and causes the page to be insecure. not a problem as only the admin uses this page and can just click the "ok" button in IE insecure content popup (no pop in FF). This can probably be fixed by modifying the over-ride template in  /templates/YOURTEMPLATE/html/com_virtuemart/user

a quick and dirty way to get it done until someone creates a plugin that adjusts for this, otherwise -- try  "System - SSL Redirect"
http://extensions.joomla.org/extensions/site-management/url-redirection/11326
This worked in some instances and not in others, but see what works for your server configuration.
Unfortunately, this plugin also STAYS in SSL mode when going from ssl to other unrequired ssl pages, so try my above code if this plugin is not working the way it should.


Also, for my template code changes -- I've turned off "Enable SSL for sensitive areas (recommended) " in the VM config and let the above do the work.




JohnHunter

very nice, thank you...

your original plugin code works well turning things off while in the VM component category and product details pages,
but does not redirect from https to http when following the https menu links or module links back to other components or pages outside of VM component.
Below, I made only minor changes to your original code in virtuemartsslredirect.php

please test on your end,  my settings in VM are:     under configuration tab "shop" with "Enable SSL for sensitive areas (recommended)" checked on

this will remove ssl on all pages but VM "cart", "user" or "orders" views
and should redirect  all other back to non-ssl

============================= cut n' paste ================================================
<?php
// Banquet Tables Pro pay with a tweet @BanquetTables


$app = JFactory::getApplication();
   if (!$app->isAdmin()) {
$viewpage=JRequest::getVar('view');
if ( $viewpage!='cart' || $viewpage!='user'|| $viewpage!='orders'){
$uri = JURI::getInstance();
         $currentcheck = $uri->toString(array('scheme', 'host', 'port', 'path', 'query', 'fragment'));
         $comparethis = str_replace( 'https:', 'http:', $currentcheck );
      if ($comparethis !== $currentcheck){
       $app = JFactory::getApplication();
$app->redirect($comparethis, null, null, true, true);
       }   

}   
   }   

?>
============================= cut n' paste ================================================


the above change caused a weird thing, and now the VM pages no longer go into ssl when the above code is used
just me? please test....

Thank you for sharing


PRO

JohnHunter,
I do not know.

BUT: The logic of the way I wrote the plugin to only do category and product details is because you do NOT want extra code running on every single page on your website.
Its a performance issue. For my site, I am keeping it the way it is

DayCounts

Hey Guys,

Have you explored the possibility in Joomla 2.5 menus to force http or https for specific menu items?
Let's say you have a contact us page and it should remain non-secure, open the menu item pointing to it and in the meta data settings, seet the secure setting to 'off'.
even if you are on a secure page (let's say cart), the menu links pointing to the contact us page will be in http.


volksman3

Hi All,

Been having the SSL issues people have mentioned here and i found this worked for me http://extensions.joomla.org/extensions/site-management/url-redirection/11326 allows redirection to SSL and back to SSL for selected pages, works with SEF URLs and VM2
Parachutes are like minds, they only work when they are open!
http://www.akirastudio.co.uk