Direct Access Static Files in Google's Project IDX
By Webotapp Academy•
<!-- wp:code -->\n<pre class=\"wp-block-code\"><code><?php\n// index.php\n\n// Serve static files directly if they exist\n$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);\n$ext = pathinfo($path, PATHINFO_EXTENSION);\n\nif ($ext && in_array($ext, ['css', 'js', 'png', 'jpg', 'jpeg', 'gif'])) {\n if (file_exists(__DIR__ . $path)) {\n return false; // serve the requested resource as-is.\n }\n}\n\n// Your PHP code goes here\n</code></pre>\n<!-- /wp:code -->\n<p> </p>