Last active
December 12, 2019 08:33
-
-
Save Ginnw2/ad90947d411ccfcc76bbaae2bcca54de to your computer and use it in GitHub Desktop.
Убираем страницы с адресом http://site.site/element_code/random с учетом GET параметров
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
//удалаем GET | |
$url = explode('?', $_SERVER['REQUEST_URI']); | |
//получаем ссылку без GET | |
$url = $url[0]; | |
//преобразовываем в массив | |
$pieces = explode("/", $url); | |
$new_array = array_diff($pieces, array('')); | |
//проверяем соответствие кода элемента и последнего элемента массива | |
if(end($new_array)!=$_REQUEST["ELEMENT_CODE"]) | |
LocalRedirect("/404.php", "404 Not Found"); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment