doubledee Posted November 6, 2011 Share Posted November 6, 2011 (Trying to get my brain back into this old problem which I fixed but want to re-code a better way...) So I was having problems with getting some browser error when people would go to checkout because the page logo was coming from an HTTP source and the page was an HTTPS page. I created a "config" file and had this code... <?php define('ENVIRONMENT', 'development'); //define('ENVIRONMENT', 'production'); // Secure Web Server Root define('SECURE_WEB_ROOT', ENVIRONMENT === 'development' ? 'http://local.dev3/' : 'https://www.mysite.com/'); ?> Then in my page I had... <div id="header"> <a href="<?php echo WEB_ROOT ?>index.php"> <img id="logo" src="<?php echo SECURE_WEB_ROOT ?>images/mylogo_200x50.png" width="200" alt="My Logo" /> </a> </div> Is there a better way to do this and eliminate my Config file which is no longer needed since I learned how to create a "Virtual Server"? Debbie Quote Link to comment https://forums.phpfreaks.com/topic/250577-problem-with-logo-and-https/ Share on other sites More sharing options...
trq Posted November 7, 2011 Share Posted November 7, 2011 If you use relative paths for things like images you don't need to worry about the domain part of the url at all. Quote Link to comment https://forums.phpfreaks.com/topic/250577-problem-with-logo-and-https/#findComment-1285733 Share on other sites More sharing options...
doubledee Posted November 7, 2011 Author Share Posted November 7, 2011 If you use relative paths for things like images you don't need to worry about the domain part of the url at all. Upon reflection, if I am now using a virtual host then I shouldn't need to use any absolute paths and, as you mentioned, that should take care of my issue. Thanks, Debbie Quote Link to comment https://forums.phpfreaks.com/topic/250577-problem-with-logo-and-https/#findComment-1285747 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.