Uncategorized
Direct Access Static Files in Google's Project IDX
Admin
July 13, 2024
13 views
<?php
// index.php
// Serve static files directly if they exist
$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$ext = pathinfo($path, PATHINFO_EXTENSION);
if ($ext && in_array($ext, ['css', 'js', 'png', 'jpg', 'jpeg', 'gif'])) {
if (file_exists(__DIR__ . $path)) {
return false; // serve the requested resource as-is.
}
}
// Your PHP code goes here
Tags:
Direct Access Static Files