Revision: 72420
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 21, 2017 23:30 by catswhocode
Initial Code
<?php $files = array( 'ga.js' => 'https://ssl.google-analytics.com/ga.js', 'bsa.js' => 'https://s3.buysellads.com/ac/bsa.js', 'pro.js' => 'https://s3.buysellads.com/ac/pro.js' ); if(isset($files[$_GET['file']])) { if ($files[$_GET['file']] == 'ga.js'){ header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + ((60 * 60) * 48))); // 2 days for GA } else { header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60))); // Default set to 1 hour } echo file_get_contents($files[$_GET['file']]); } ?>
Initial URL
https://www.catswhocode.com/blog/php-how-to-add-expire-headers-for-external-scripts
Initial Description
Create a file named externaljs.php. Then link to it: <script></script>
Initial Title
How to add expire headers for external scripts
Initial Tags
Initial Language
PHP