lhoist-stay-safe__backend-t.../includes/redirections.php

25 lines
599 B
PHP

<?php
add_action('template_redirect', function () {
if ($_SERVER['REQUEST_URI'] == '/tutorial') {
// $reactAppPath = __DIR__ . '/../../../../react_app/test.html';
$reactAppPath = ABSPATH . 'wp-content/themes/build/index.html';
if (file_exists($reactAppPath)) {
global $wp_query;
$wp_query->is_404 = false;
status_header(200);
// header('Content-Type: text/html');
// readfile($reactAppPath);
include($reactAppPath);
} else {
// Gérer le cas où le fichier n'existe pas
echo "Page not found.";
status_header(404);
}
exit();
}
});