introducing redirection component that will be deleted later

This commit is contained in:
Antoine M 2024-02-22 19:17:16 +01:00
parent facf0a34f9
commit 7b0dc1fcb0

24
includes/redirections.php Normal file
View File

@ -0,0 +1,24 @@
<?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();
}
});