Jump to content

Problem with Logo and HTTPS


doubledee

Recommended Posts

(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

 

Link to comment
https://forums.phpfreaks.com/topic/250577-problem-with-logo-and-https/
Share on other sites

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

 

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.