Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Images and Links being called from https...


Guest

Recommended Posts

First of all, here's a link to the site in question.

 

OK, here's the problem. I have had loads of trouble getting ssl to work on my site. It is a shared ssl through *shudder* Netfirms. I finally got ssl to work by editing application_top.php code on line 41 to this:

 

// set the type of request (secure or not)
 //$request_type = (getenv('HTTPS') == 'on') ? 'SSL' : 'NONSSL';
 $request_type = (getenv('SERVER_PORT') == '80') ? 'SSL' : 'NONSSL';

So that got my pages to display a full lock and everything. Everything else works well. The only problem is all links and images link to https when they obviously should not. I am using STS by the way, and no these links are not hardcoded into the page. The links I put in look like so..

 

<img src="/store/nfoscomm/catalog/images/header/abstop_bgsep.gif">

 

But it's not just images it's also the links linking to https. I have tried various solutions that I searched for on these forums, such as...

 

http://www.oscommerce.com/forums/index.php?showtopic=88432&hl=

http://www.oscommerce.com/forums/index.php?showtopic=61632&hl=

 

..and many others that the links to are not fresh on my mind. I have literally worn the search button out :rolleyes:

 

The admin directory however, works fine. I will post my configure.php in hopes it's something simple I may have missed in there, but I doubt it. I am starting to think it's my host (Netfirms) that is the problem. Wouldn't be the first. Thank god I am switching hosts in November. :)

 

heres my configure.php

 

// Define the webserver and path parameters
// * DIR_FS_* = Filesystem directories (local/physical)
// * DIR_WS_* = Webserver directories (virtual/URL)
 define('HTTP_SERVER', 'http://pinpproductions.com'); // eg, http://localhost - should not be empty for productive servers
 define('HTTPS_SERVER', 'https://pinpproductions.sslpowered.com'); // eg, https://localhost - should not be empty for productive servers
 define('ENABLE_SSL', true); // secure webserver for checkout procedure?
 define('HTTP_COOKIE_DOMAIN', 'pinpproductions.com');
 define('HTTPS_COOKIE_DOMAIN', 'pinpproductions.sslpowered.com');
 define('HTTP_COOKIE_PATH', '/store/nfoscomm/catalog/');
 define('HTTPS_COOKIE_PATH', '/store/nfoscomm/catalog/');
 define('DIR_WS_HTTP_CATALOG', '/store/nfoscomm/catalog/');
 define('DIR_WS_HTTPS_CATALOG', '/store/nfoscomm/catalog/');
 define('DIR_WS_IMAGES', 'images/');
 define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');
 define('DIR_WS_INCLUDES', 'includes/');
 define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');
 define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
 define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
 define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
 define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');

 define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');
 define('DIR_FS_CATALOG', dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']));
 define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
 define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

 

Hopefully I worded this question well enough. Thanks for your time.

-Derek

Link to comment
Share on other sites

Oh yeah forgot to mention that the links I am referring to are the links under "Store Information" in the main body of the page.

 

Thought I'd clarify that. :P

 

-Derek

 

Edit 2: Appears it's also doing this on my custom search jobby at the top of the page and the links at the very very top right...

Link to comment
Share on other sites

Hmm, I am trying to think of more info to help you understand the problem but I think I've pretty much covered it all.

 

I still think it is the way you define your links. When you look at the standard stuff like category box and information box, those links are ok.

Treasurer MFC

Link to comment
Share on other sites

Hey Amanda, Thanks for jumping in to help. The way I define my links in my /includes/sts_template.html file and my includes/languages/english/index.php and others are like so...

<img src="/folder/images/imagename.gif.">

I don't know why the links in the left column are not showing https while the rest are. But it doesn't matter where you go in my catalog, the images are always being loaded from https.

Link to comment
Share on other sites

Hey Amanda, Thanks for jumping in to help.  The way I define my links in my /includes/sts_template.html file and my includes/languages/english/index.php and others are like so...

<img src="/folder/images/imagename.gif.">

I don't know why the links in the left column are not showing https while the rest are.  But it doesn't matter where you go in my catalog, the images are always being loaded from https.

 

what if you put your base href back in ?

 

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

Treasurer MFC

Link to comment
Share on other sites

Drop this little file in your root folder and we'll find out how to set this line:

 

$request_type = (getenv('SERVER_PORT') == '80') ? 'SSL' : 'NONSSL';

 

Port 80 will put you permanently into ssl land.

 

Name it myenv.php

<?php
  echo 'HTTP HOST: ' . "$HTTP_HOST";
  echo '<br>Server Port: ' . getenv('SERVER_PORT');
  echo '<br>SSL Status: ' . getenv('HTTPS');
  echo '<br>Fowarded Server: ' . getenv('HTTP_X_FORWARDED_SERVER');
  echo '<br>Fowarded Host: ' . getenv('HTTP_X_FORWARDED_HOST');
?>

 

Let us know when it's there.

Local: Mac OS X 10.5.8 - Apache 2.2/php 5.3.0/MySQL 5.4.10 • Web Servers: Linux

Tools: BBEdit, Coda, Versions (Subversion), Sequel Pro (db management)

Link to comment
Share on other sites

From myenv.php...

 

HTTP HOST: www.pinpproductions.com
Server Port: 80
SSL Status:
Fowarded Server: w0_2
Fowarded Host: www.pinpproductions.com

 

http://pinpproductions.com/myenv.php

 

This tip I got from you in another thread,  that is how I got ssl to come on in the first place.

 

Here's the important one:

 

https://pinpproductions.sslpowered.com/myenv.php

 

It returns:

 

HTTP HOST: pinpproductions.sslpowered.com

Server Port: 80

SSL Status:

Fowarded Server: w0_2

Fowarded Host: pinpproductions.sslpowered.com

 

So, set line 41 like so:

 

$request_type = (getenv('HTTP_X_FORWARDED_HOST') == 'pinpproductions.sslpowered.com') ? 'SSL' : 'NONSSL';

 

This would probably work too but the above is probably more reliable.

 

$request_type = (getenv('HTTP_X_FORWARDED_SERVER') == 'w0_2') ? 'SSL' : 'NONSSL';

Local: Mac OS X 10.5.8 - Apache 2.2/php 5.3.0/MySQL 5.4.10 • Web Servers: Linux

Tools: BBEdit, Coda, Versions (Subversion), Sequel Pro (db management)

Link to comment
Share on other sites

Thanks Alan, This line got it...

$request_type = (getenv('HTTP_X_FORWARDED_HOST') == 'pinpproductions.sslpowered.com') ? 'SSL' : 'NONSSL';

 

All fixed. You rock. Thanks a ton!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...