Hi all! New Zenner here and I'm not very PHP savvy. I have a question about using relative image links in my code. I apologize that this post will be long winded, but I want to make sure you know every step I've taken so far.
I recently changed the store's configure.php file so that the checkout process would run on a secure server. Here's what I have in the configure.php file:
I had placed absolute linked images in the tpl_header.php file to customize the look of the header. But when the customer gets to the checkout process, the browser's security report would say that some of the information on the page was not secure. Sooo, I changed the tpl_header.php code to use relative images, like this:Code:// Define the webserver and path parameters // HTTP_SERVER is your Main webserver: eg, http://www.yourdomain.com // HTTPS_SERVER is your Secure webserver: eg, https://www.yourdomain.com define('HTTP_SERVER', 'http://store.mydomain.com'); define('HTTPS_SERVER', 'https://secure.bluehost.com/~mydomain/store'); // Use secure webserver for checkout procedure? define('ENABLE_SSL', 'true'); // NOTE: be sure to leave the trailing '/' at the end of these lines if you make changes! // * DIR_WS_* = Webserver directories (virtual/URL) // these paths are relative to top of your webspace ... (ie: under the public_html or httpdocs folder) define('DIR_WS_CATALOG', '/'); define('DIR_WS_HTTPS_CATALOG', '/');
This works fine on the unsecured pages, but once you get to the checkout screen, the images are broken because the website is trying to pull the image from the following location:Code:<img src="../images/my-header.png" />
Which doesn't exist. The store is actually in a directory. BUT, I can't have the SRC say "/store/images/myheader.png" because the root is the subdomain (I'm only using this host for subdomains). So on the checkout page the image would show up, but on the unsecured pages it would pull the image from "http://store.mydomain.com/store/images/myheader.png."Code:https://secure.bluehost.com/~mydomain/images/my-header.png
My solution was placing absolute image links in the tpl_header.php file TO the secure server, like so:
Now the images load fine across the board, and there are no security report issues, but it's slower this way, and just seems like a silly way of doing things in general.Code:<img src="https://secure.bluehost.com/~mydomain/store/images/my-header.png" />
In short (too late), how might I place images in tpl_header.php file without screwing up the security report on the checkout pages, or having the secure pages point to images that don't exist?
Any suggestions? I'm actually hoping that I'm just an idiot and am missing something so simple, so easy... Maybe there's a way to write it in PHP instead of straight HTML that would get the images to load on unsecured and secured pages alike... Alas, I have no idea how to write it...
Thanks to anyone who made it to the bottom of this post! :)



Reply With Quote

