Author Topic: Not redirecting to https  (Read 15397 times)

coleision

  • Beginner
  • *
  • Posts: 11
Not redirecting to https
« 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!


coleision

  • Beginner
  • *
  • Posts: 11
Re: Not redirecting to https
« Reply #1 on: June 14, 2009, 18:28:56 pm »

ipoima

  • Beginner
  • *
  • Posts: 3
Re: Not redirecting to https
« Reply #2 on: July 20, 2009, 10:23:59 am »
I have the same problem.
Can anybody suggest a solution?

Thank you
Ipo Ima

andpatton

  • Beginner
  • *
  • Posts: 32
    • acusti.ca
Re: Not redirecting to https
« Reply #3 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]

Forrest

  • Full Member
  • ***
  • Posts: 1972
  • Me and my baby
    • Web Developer
Re: Not redirecting to https
« Reply #4 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

QubeSys Technologies

  • Jr. Member
  • **
  • Posts: 288
  • Joomla & Magento Services
Re: Not redirecting to https
« Reply #5 on: February 16, 2010, 06:21:33 am »
Will this above solution solve the images not appearing on checkout pages problem ??
Blissful!

Forrest

  • Full Member
  • ***
  • Posts: 1972
  • Me and my baby
    • Web Developer
Re: Not redirecting to https
« Reply #6 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.

QubeSys Technologies

  • Jr. Member
  • **
  • Posts: 288
  • Joomla & Magento Services
Re: Not redirecting to https
« Reply #7 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 ??   ::) ::) ::)
Blissful!

Forrest

  • Full Member
  • ***
  • Posts: 1972
  • Me and my baby
    • Web Developer
Re: Not redirecting to https
« Reply #8 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.

QubeSys Technologies

  • Jr. Member
  • **
  • Posts: 288
  • Joomla & Magento Services
Re: Not redirecting to https
« Reply #9 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.
Blissful!

Forrest

  • Full Member
  • ***
  • Posts: 1972
  • Me and my baby
    • Web Developer
Re: Not redirecting to https
« Reply #10 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.

QubeSys Technologies

  • Jr. Member
  • **
  • Posts: 288
  • Joomla & Magento Services
Re: Not redirecting to https
« Reply #11 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.
Blissful!

Forrest

  • Full Member
  • ***
  • Posts: 1972
  • Me and my baby
    • Web Developer
Re: Not redirecting to https
« Reply #12 on: February 16, 2010, 08:53:31 am »
I'm not connecting... site down?

QubeSys Technologies

  • Jr. Member
  • **
  • Posts: 288
  • Joomla & Magento Services
Re: Not redirecting to https
« Reply #13 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.
Blissful!

Forrest

  • Full Member
  • ***
  • Posts: 1972
  • Me and my baby
    • Web Developer
Re: Not redirecting to https
« Reply #14 on: February 16, 2010, 08:55:26 am »
Nope