introducing redirection component that will be deleted later
This commit is contained in:
parent
facf0a34f9
commit
7b0dc1fcb0
24
includes/redirections.php
Normal file
24
includes/redirections.php
Normal 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();
|
||||||
|
}
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue
Block a user