This plugin will redirect product details & category pages back to HTTP if your are in https.
J2.5++ ONLY
Download Here
http://www.kaizenmediaworks.com/virtuemart-2-0-redirect-back-to-http-plugin
GUYS: the plugin is having a problem when using SEF urls.
To redirect back to http
You can place this code in your category and product details template
UPDATED:::::: The search module was not working when you searched from an HTTPS page.
/* Back to http */
if (JRequest::getVar('search')!='true'){
$uri = & JFactory::getURI();
$currentcheck=JURI::current();
$comparethis = str_replace( 'https:', 'http:', $currentcheck );
if ($comparethis !== $currentcheck){
$app = JFactory::getApplication();
$app->redirect($comparethis, null, null, true, true);
}
}
guys has anyone tested this?
is it working? with and without SEF?
It works without SFE.
Thanks, I was looking a urgent solution.
can we check to see if the site is loading the cart and if not then redirect all to http?
if the link = index.php?option=com_virtuemart&view=cart then https if not then http
I ask because as it is the code would work on pages it is inserted but what if used in main index.php of template. Would it override the one that switches to https? I have code in place that puts the cart into https regardless of any settings.
on default cart page /template/mytemplate/html/com_virtuemart/cart/default.php
$currentcheck = JURI::current();
$comparethis = str_replace( 'http:', 'https:', $currentcheck );
if ($comparethis !== $currentcheck){
$app = JFactory::getApplication();
$app->redirect($comparethis, null, null, true, true);
}
I do this with cart & user pages.
To make sure its ssl, to pass PCI testing
<?php
// make sure its HTTPS
$uri = & JFactory::getURI();
$currentcheck=JURI::current();
$comparethis = str_replace( 'http:', 'https:', $currentcheck );
if ($comparethis !== $currentcheck){
$app = JFactory::getApplication();
$app->redirect($comparethis, null, null, true, true);
}
?>
I downloaded the plugin and turned it on. I did not get any errors but it did not change the http to https. However I was wondering. You are doing a check to see what the view is. Can that be adjusted to check the links? Say for address, billing, cart, etc.,?
the plugin will not work with sef urls.
just use the code I posted in whatever template you want it in.
Hi, it seems like a lot of people have run into the problem of non-secure pages being set to HTTPS after visiting the first secure pages. I appreciate that you wrote this plugin but it seems to be that this is a bug in VM2 and should be handled as such. In addition, a plugin that doesn't work with SEF is not something I or others can use in a production site: first, we have a lot of internal links built with SEF URLs, and second, my client will not accept non-SEF URLs in a live site. Is there any way to get this fixed as part of VM2 where it will work under all circumstances? This is very important.
I use these codes in my templates that i want to force either ssl or non ssl
Force NON ssl
<?php
/* Back to http */
$currentcheck = JURI::current();
$comparethis = str_replace( 'https:', 'http:', $currentcheck );
if ($comparethis !== $currentcheck){
$app = JFactory::getApplication();
$app->redirect($comparethis, null, null, true, true);
}
?>
Force SSL on pages
<?php
// make sure its HTTPS
$uri = & JFactory::getURI();
$currentcheck=JURI::current();
$comparethis = str_replace( 'http:', 'https:', $currentcheck );
if ($comparethis !== $currentcheck){
$app = JFactory::getApplication();
$app->redirect($comparethis, null, null, true, true);
}
?>
Where do I put this code? And will this work with SEF?
you put the code IN WHATEVER template you need it in
http://forum.virtuemart.net/index.php?topic=90935.0
for example
on cateogry & product page. I do "back to http"
on user page, & cart page, I do "force https"
Thanks for your help these changes worked for me. And I have SEF turned on and it is working perfectly. Your forum entry about VM 2.0 templates helped so much.
Quote from: PRO on June 10, 2013, 19:19:13 PM
you put the code IN WHATEVER template you need it in
http://forum.virtuemart.net/index.php?topic=90935.0
for example
on cateogry & product page. I do "back to http"
on user page, & cart page, I do "force https"
Are these to go into the main template file for the site or VM template files? Sorry just trying to get to the solved issue.
Thanks,
Jeremy
You want to override the joomla template. Follow the instructions here - http://forum.virtuemart.net/index.php?topic=90935.0
Thank you tmdonovan,
Do I need to download a plugin or anything for this to take affect.
Jeremy
I didn't use the Back to HTTP Redirect plugin described in the first post of this thread. I am an experienced programmer, so I followed the instructions to manually override the joomla template, then modified the productdetails and category default.php files directly to handle the "back to HTTP" function, as described by PRO on June 10, 2013 at 11:19:13.
The first post has the link to download the plugin, and I will have to defer to PRO's expertise with respect to its use.
I prefer programming, instead of plugin. Thank you so much for your clarity on this.
Jeremy
the "plugin" will not work with SEF urls, BECAUSE system plugins run BEFORE JRoute (which is what makes the urls)
SO: when you put the code in your VIRTUEMART template override files,it will work with SEF urls.
so for example
views/tmpl/productdetails/default.php
HERE.
BUT!
Do a template override
http://forum.virtuemart.net/index.php?topic=90935.0
Would it be possible to just do <?php
$view = JRequest::getVar('view'); // checks to see what view you are on EX: category
if ($view == 'TheViewYouwant') {
/*check to see if https if not make https */
$currentcheck = JURI::current();
$comparethis = str_replace( 'http:', 'https:', $currentcheck );
if ($comparethis !== $currentcheck){
$app = JFactory::getApplication();
$app->redirect($comparethis, null, null, true, true);
} else {
/* check if http and if not set to http */
$currentcheck = JURI::current();
$comparethis = str_replace( 'https:', 'http:', $currentcheck );
if ($comparethis !== $currentcheck){
$app = JFactory::getApplication();
$app->redirect($comparethis, null, null, true, true);
}
}
?>
It does not really require anything other than the view. Possibly use or to add more views into the list? What you think Pro?
Quote from: Stonedfury on June 11, 2013, 23:27:11 PM
Would it be possible to just do <?php
$view = JRequest::getVar('view'); // checks to see what view you are on EX: category
if ($view == 'TheViewYouwant') {
/*check to see if https if not make https */
$currentcheck = JURI::current();
$comparethis = str_replace( 'http:', 'https:', $currentcheck );
if ($comparethis !== $currentcheck){
$app = JFactory::getApplication();
$app->redirect($comparethis, null, null, true, true);
} else {
/* check if http and if not set to http */
$currentcheck = JURI::current();
$comparethis = str_replace( 'https:', 'http:', $currentcheck );
if ($comparethis !== $currentcheck){
$app = JFactory::getApplication();
$app->redirect($comparethis, null, null, true, true);
}
}
?>
It does not really require anything other than the view. Possibly use or to add more views into the list? What you think Pro?
where would you put this?
it cant be a plugin because system plugins dont know the "view" unless its actually in the url.
you could do something like this in your joomla template though if you want.
you can use the code however you want.
But I use mine just like I posted before,
I use it in specific templates etc. to->https or back to->http
I also use it in my content templates
Maybe the index.php. It was a thought.
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.
This is a great plugin for redirects, thanks for coming across it.