0
Comment bloquer (redirect) une page si la page est dans un fichier txt:Comment bloquer certaines pages si dans le fichier txt
Je cet extrait - les bonnes nouvelles est l'URL dans block.txt sera bloqué (site blanc), mais je veux qu'il rediriger vers /file-not-found.php
<?php
list($blockExist, $blockData) = array(false, null);
if (is_string($blockData = @file_get_contents('/block.txt'))) {
$blockData = preg_replace('/\s+/', '', $blockData);
}
if (isset($_SERVER['REQUEST_URI'])) {
$httpLink = explode('?', $_SERVER['REQUEST_URI']);
$httpLink = $httpLink[0] == '/' ? null : $httpLink[0];
}
if ($blockData != null && $httpLink != null && stripos("{$blockData}http://", "{$httpLink}http://") !== false) {
$blockExist = true;
}
if ($blockExist) {
require_once dirname(__FILE__) . '/file-not-found.php';
exit;
}
?>