'text/css', 'js' => 'application/javascript', 'json' => 'application/json', 'png' => 'image/png', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'gif' => 'image/gif', 'svg' => 'image/svg+xml', 'webp' => 'image/webp', 'woff' => 'font/woff', 'woff2' => 'font/woff2', 'ttf' => 'font/ttf', 'eot' => 'application/vnd.ms-fontobject', ]; $contentType = $contentTypes[$extension] ?? 'application/octet-stream'; // Set proper headers header('Content-Type: ' . $contentType); header('Content-Length: ' . filesize($fullPath)); // Cache for 24 hours (86400 seconds) $expires = 86400; header('Cache-Control: public, max-age=' . $expires); header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT'); header('Pragma: cache'); // Output the file readfile($fullPath);