mjurmann Posted April 2, 2008 Share Posted April 2, 2008 Hello, for some reason when going to my secure server, https:///www.site.com, I get an error telling me that the information on the page is partially encrypted. After researching this matter a bit, I discovered that I am getting this error because the file paths on my https: and http: sites are both absolute and all files within begin with http://. Therefore, the https: is telling me that the information is partially encrypted because there are http:// file paths inside of the https:// site. Does anyone know of a way to fix this? Can I just have all of the absolute http:// file paths be rewritten to https://, or will that bog down resources? Is there any better way of doing this? It seems to be a big problem, with hopefully a simple solution. Thank you to anyone who can help me. Link to comment https://forums.phpfreaks.com/topic/99238-file-paths-and-ssl/ Share on other sites More sharing options...
Caesar Posted April 2, 2008 Share Posted April 2, 2008 Use relative paths. Unless, you're linking to external sites...then,...yeah. Link to comment https://forums.phpfreaks.com/topic/99238-file-paths-and-ssl/#findComment-507854 Share on other sites More sharing options...
discomatt Posted April 2, 2008 Share Posted April 2, 2008 Relative links are your best bet, otherwise, use object buffering and do this <?php ob_start(); // do code ect $subject = ob_get_clean(); if ( strstr($_SERVER['SERVER_PROTOCOL'], 'HTTPS') ) $subject = str_replace('http', 'https', $subject); echo $subject; ?> Or you can use preg_replace to replace with stricter rules Link to comment https://forums.phpfreaks.com/topic/99238-file-paths-and-ssl/#findComment-507869 Share on other sites More sharing options...
mjurmann Posted April 2, 2008 Author Share Posted April 2, 2008 I'm trying to use relative links, and to my surprise this isn't working. The original CSS file is at: http://www.site.com/css/styles.css So in the <HEAD>, I have: <link href="http://www.site.com/css/styles.css" rel="stylesheet" type="text/css" media="screen" /> This works fine. However, when I try to use a relative path, it doesn't work. <link href="../css/styles.css" rel="stylesheet" type="text/css" media="screen" /> I have a ../css because the styles.css file is being called from http://www.site.com/includes/stylesheet-caller.php. I've been working with PHP for a while now, and can't believe this is happening. Why would the CSS file not be included? The css directory is in the same root as the includes/ directory, so shouldn't it be: ../styles.css What the heck is going on here? Link to comment https://forums.phpfreaks.com/topic/99238-file-paths-and-ssl/#findComment-507924 Share on other sites More sharing options...
mjurmann Posted April 2, 2008 Author Share Posted April 2, 2008 I must use a relative path for my CSS and Javascript files. The relative path works fine when I go to my store's folder (not the subdomain); however, when I navigate to the subdomain itself, the CSS style sheet is not loading. Does anyone know what this could be? Link to comment https://forums.phpfreaks.com/topic/99238-file-paths-and-ssl/#findComment-507929 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.