$sRequestUri = trim( $_SERVER['REQUEST_URI'], '/' ); $sContentFolder = __DIR__ . '/content/'; $sContentFilePath = $sContentFolder . $sRequestUri . '.html'; if ( !is_dir($sContentFilePath) ) { header ( 'HTTP/1.0 404 Not Found' ); $sContentFilePath = $sContentFolder . '404.html'; } echo file_get_contents( $sContentFilePath );