Here's the code for how I do this:
Code: Select all
<?php
if( isset($_SERVER['HTTP_REFERER']) ) { $CurrentURL = $_SERVER['HTTP_REFERER']; } else { $CurrentURL = ''; }
$FindInURL = 'https';
$URLSecure = strpos($CurrentURL, $FindInURL);
if ($URLSecure === false) {
$RelURL = 'http://www.mysite.com/';
} else {
$RelURL = 'https://www.mysite.com/';
}
?>The drawback of this method is that if I have 50 references to images or links that use this $RelURL, then the file size increases significantly.
Any ideas would be appreciated!