VirtueMart Forum

VirtueMart 1.1.x [ Old version - no longer supported ] => Security (https) / Performance / SEO/ SEF issues VM 1.1 => Topic started by: coleision on June 14, 2009, 07:12:28 am

Title: Not redirecting to https
Post by: coleision on June 14, 2009, 07:12:28 am
I looked around this forum and could not find any similar issues. So hopefully there is an easy fix and maybe I missed something.

I setup a SSL on a dedicated IP address etc. I can access directly https://www.mydomain.com or http://mydomain.com

Now I set the the following settings in vm config

Site URL - http://www.mydomain.com
Secure URL - https://www.mydomain.com

(I have also tried removing the www.)

Shop areas which must use https - Account, Admin and Checkout


Now here is my issue, when I got to check out it does not redirect to https, it stays at http. So my url looks like this

http://mydomain.com/buy-now/checkout/ssl_redirect.html

Now if I add all the options for the shop areas, then it does work. Which is very weird but not needed as then the homepage is showing as secure as well.

I am using SEF urls and not sure if this would cause these issues or not.

Also have done some editing to my .htaccess so that www.mydomain.com to mydomain.com ( have tried both ways and turning this off.

Any ideas on this would be very much appreciated!

Title: Re: Not redirecting to https
Post by: coleision on June 14, 2009, 18:28:56 pm
Also I am using the Router.php file from

http://extensions.joomla.org/extensions/extension-specific/virtuemart-extensions/7512/details
Title: Re: Not redirecting to https
Post by: ipoima on July 20, 2009, 10:23:59 am
I have the same problem.
Can anybody suggest a solution?

Thank you
Ipo Ima
Title: Re: Not redirecting to https
Post by: andpatton on October 06, 2009, 18:27:32 pm
I hope this could still be of some use to you, or someone else, despite this topic being 2 1/2 months cold.

This is a chronic problem I've seen mentioned many places, and the fix apparently offered from the publishers didn't work for me, at least. So, I went ahead and modified the router.php file they offer to make it work when redirecting to the checkout page. When testing with and without SSL, it works, though it also means that the checkout pages no longer use SEF urls (not a problem in terms of SEO, seeing as you don't want those pages indexed anyways). The problem for me, however, was that after going to the checkout pages and then going to other parts of the site, keeps using https:// and the user keeps using it the whole time.

In order to solve this, I looked at how VM tries to "Generally prevent https connections" (the option in the 'Security Settings' section of the VM configuration), which makes it so that when not in an area of the site that requires https, VM makes sure the user gets switched to using http://. However, this feature does not work when using SEF urls (because it will only do it if it finds a url query string, which doesn't exist in SEF). So, I added a couple of lines to the administrator/components/com_virtuemart/classes/ps_session.php file to fix that. Here they are:

Code: [Select]
// Modified to add conditional for situations where we are using SEF
// Are we in SEF mode?
if ($mainframe->getCfg( 'sef' ) == 1 && empty($query_string) && empty( $_POST )) {
vmRedirect(str_replace(SECUREURL, URL, JURI::current()));
}

I inserted those lines at around line 257, after these lines:
Code: [Select]
$query_string = vmGet($_SERVER,'QUERY_STRING');
if( !empty($query_string) && empty( $_POST )) {
vmRedirect( $this->url( URL.basename( $_SERVER['PHP_SELF']).'?'.vmGet($_SERVER,'QUERY_STRING').'&redirected=1', true, false, true ));
}

I've attached a zip package with the updated router.php file and my slightly modified version of the ps_session.php file (which is only necessary if you want to 'Generally prevent https connections')

[attachment cleanup by admin]
Title: Re: Not redirecting to https
Post by: Forrest on January 10, 2010, 03:24:09 am
You don't need to modify the source code. There are two things you can do to adjust for this.

1. In any Joomla menu items, under advanced, select NO SSL (instead of IGNORE, which is th default) option for each menu item not requiring SSL.

2. Download my VM cat menu mod here.
http://forum.virtuemart.net/index.php?topic=64791.msg216147#msg216147
It does a lot in terms of acting more like a Joomla menu system rather than a VM menu system:
jroute for Joomla SEF, XHTML, specify Module Class Suffix, Menu ID Suffix, Menu Class Suffix, Store ID Override, Category Start ID, Level (Row) Start, Always Show Sub Items, AND FORCE SSL or FORCE NON-SSL.

That should solve your problems, give you more flexibility, and not have to adjust core files.


NOTE: I did not look at the above router.php file, but I do have it running as well with my config. Please check out this post for account/checkout redirect issues.
http://forum.virtuemart.net/index.php?topic=58901.msg216282#msg216282


As an update... andpatton's solution may cause dup domain problems in product detail URLS. See this post: http://forum.virtuemart.net/index.php?topic=68906.0;topicseen
Title: Re: Not redirecting to https
Post by: QubeSys Technologies on February 16, 2010, 06:21:33 am
Will this above solution solve the images not appearing on checkout pages problem ??
Title: Re: Not redirecting to https
Post by: Forrest on February 16, 2010, 08:09:55 am
That depends. Are you getting "insecure" errors on checkout? If you are not using relative URLS for your images, then this could be an issue.

For instance:
My image is being called out as http://www.somesite.com/images/thisimage.jpg

But during checkout I'm on https, so the images using http will either not load, or will cause the browser to have "insecure" data issues, whereby some of the data being passed to the client is not secure (https) because it's being called out with the absolute http://www.somesite.com.

So two questions...
1. what images are not loading? CSS images, or cart images, or other images within mods, etc.
2. if you are using https can you try your site at https://www.mysite.com (where mysite is your site domain) as see if you have similar issues, or is this ONLY a checkout problem.
Title: Re: Not redirecting to https
Post by: QubeSys Technologies on February 16, 2010, 08:27:52 am
Well, all the CSS images were missing the cart images as well..

Now, I just switched off the COOKIE CHECK and cart images appeared.

Then I hardcoded all the css links on the index.php of the template and placed direct absolute URLs there and now all the CSS images are also appearing..

But all with http only.

So, all insecure images.

I know,this is a temporary fix and client wont allow this..

So, Im looking for a hardcore fix, which can fix it directly on Virtuemart, so that everything appears fine when it gets to https://

Any solution bro ??   ::) ::) ::)
Title: Re: Not redirecting to https
Post by: Forrest on February 16, 2010, 08:35:50 am
1. I would undo the hardcode of absolute URLS, and put them back to relative. This way when you fix it, you'll know it becuse things will be working with relative :)

2. Are you using something like firebug, or some element inspector to see what the URL is of the images not appearing when they should. This will usually help pin the problem down.

3. Are you running cache or g-zip. If so, turn it all off for now. Places to check:
a. Gzip plugins (like yoo effects)
b. Joomla cache plugin
c. template settings (some have gzip settings)
d. Joomla config for both cache and gzip

4. You might try manually editing your configuration.php and insert the live_site, which would be you domain "http://www.somesite.com/"

5. Clear your browser and Joomla cache after checking all above. Refresh and try again.
Title: Re: Not redirecting to https
Post by: QubeSys Technologies on February 16, 2010, 08:43:38 am
Its the http:// images which are not appearing, and the whole CSS is not there as well, when I have relative URLs in the CSS as base_url php calling the path.

And in my live site var in config file, I have it right but not with an ending slash.
Title: Re: Not redirecting to https
Post by: Forrest on February 16, 2010, 08:47:18 am
So your css isn't showing up... again, use an element inspector and look at view source to see that it is in fact being called out. I know, it sounds silly but make sure to check.

Secondly, I highly recommend turning off any caching and gzip option per described above. this may be a problem.
Title: Re: Not redirecting to https
Post by: QubeSys Technologies on February 16, 2010, 08:50:36 am
Also, my Gzip or any cache are not enabled.

The URL is, http://tinyurl.com/ykx3rf3

You can see the error now. I have restored the old index.php now.
Title: Re: Not redirecting to https
Post by: Forrest on February 16, 2010, 08:53:31 am
I'm not connecting... site down?
Title: Re: Not redirecting to https
Post by: QubeSys Technologies on February 16, 2010, 08:54:14 am
Try now..
I also tried connecting to https://www.domain.com  and I see, nothing gets loaded up.
Title: Re: Not redirecting to https
Post by: Forrest on February 16, 2010, 08:55:26 am
Nope
Title: Re: Not redirecting to https
Post by: QubeSys Technologies on February 16, 2010, 08:56:44 am
That is strange. Works perfect here.
Title: Re: Not redirecting to https
Post by: Forrest on February 16, 2010, 08:59:09 am
Well this may be part of your issue then, cause I'm not connecting very reliably. I just got the page back now, then refreshed and gone again.
Title: Re: Not redirecting to https
Post by: Forrest on February 16, 2010, 09:00:24 am
Yep, just not loading time and time again now.

This webpage is not available.

The webpage at https://www.XXXXXXXX.net/ might be temporarily down or it may have moved permanently to a new web address.
Title: Re: Not redirecting to https
Post by: QubeSys Technologies on February 16, 2010, 09:09:02 am
Can you try now ??

If it works, let me know.
Title: Re: Not redirecting to https
Post by: Forrest on February 16, 2010, 09:10:06 am
yes working now and images showing up.
Title: Re: Not redirecting to https
Post by: QubeSys Technologies on February 16, 2010, 09:11:00 am
I just restored my hardcoded css back , before 5 mins. Ok please check PM.
Title: Re: Not redirecting to https
Post by: QubeSys Technologies on February 24, 2010, 21:48:58 pm
Is GZIP is also a culprit for such situation ?
Im using a template in another site of mine and it has GZIP hardcoded in it by the template seller , and I have the same SSL issue there also. Can anyone assist ? :(
Title: Re: Not redirecting to https
Post by: Forrest on February 24, 2010, 22:31:50 pm
GZip has nothing to do with this. Caching may. I will be gone for 4 days. Hit me up Skpye on Monday.
Title: Re: Not redirecting to https
Post by: QubeSys Technologies on February 25, 2010, 05:02:02 am
Hmmm. Strange then. I have tried everything , but nothing works.

live_site var is filled right, www.domain.com

Title: Re: Not redirecting to https
Post by: Forrest on February 25, 2010, 22:21:54 pm
I'm on my cell, so can't look at ur site easily right now. Is the issue that it won't go to https, or that it won't leave https once you are in https?
Title: Re: Not redirecting to https
Post by: Forrest on March 01, 2010, 21:30:54 pm
you have this fixed now?